Skip to content

Commit c143f08

Browse files
committed
fix: disable table cards when column count is <= 1
1 parent c746449 commit c143f08

File tree

3 files changed

+42
-28
lines changed

3 files changed

+42
-28
lines changed

apps/site/components/EOL/VulnerabilityChips/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const VulnerabilityChips: FC<VulnerabilityChipsProps> = ({
2323
);
2424

2525
return (
26-
<div className="flex flex-row flex-wrap gap-2 max-sm:justify-end">
26+
<div className="flex flex-row flex-wrap gap-1 max-sm:justify-end">
2727
{SEVERITY_ORDER.filter(severity => groupedBySeverity[severity] > 0).map(
2828
severity => (
2929
<VulnerabilityChip

apps/site/util/table.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@ export default function remarkTableTitles() {
1414

1515
const [headerRow, ...dataRows] = table.children;
1616

17+
if (headerRow.children.length <= 1) {
18+
table.data ??= {};
19+
20+
table.data.hProperties = {
21+
'data-cards': 'false',
22+
};
23+
}
24+
1725
// Extract header labels from the first row
1826
const headerLabels = headerRow.children.map(headerCell =>
1927
toString(headerCell.children)

packages/ui-components/src/styles/markdown.css

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -128,23 +128,22 @@ main {
128128
w-full
129129
border-separate
130130
border-spacing-0
131+
border
131132
border-neutral-200
132133
text-left
133134
text-sm
134-
max-sm:block
135-
md:border
136135
dark:border-neutral-800;
137136

138137
/* Common border and text styles */
139138
th,
140139
td {
141-
@apply border-neutral-200
140+
@apply border
141+
border-r-0
142+
border-t-0
143+
border-neutral-200
144+
px-4
145+
py-2
142146
text-neutral-900
143-
md:border
144-
md:border-r-0
145-
md:border-t-0
146-
md:px-4
147-
md:py-2
148147
dark:border-neutral-800
149148
dark:text-white;
150149

@@ -153,8 +152,30 @@ main {
153152
}
154153
}
155154

156-
/* Mobile-specific styles */
157-
@media (max-width: 40rem) {
155+
th {
156+
@apply font-semibold;
157+
}
158+
159+
tr:last-child > td {
160+
@apply sm:border-b-0;
161+
162+
&:last-child {
163+
@apply max-xs:border-b-0;
164+
}
165+
}
166+
167+
td:first-child,
168+
th:first-child {
169+
@apply sm:border-l-0;
170+
}
171+
}
172+
173+
/* Mobile-specific styles */
174+
@media (max-width: 40rem) {
175+
table:not([data-cards='false']) {
176+
@apply block
177+
border-0;
178+
158179
thead {
159180
@apply sr-only;
160181
}
@@ -182,7 +203,9 @@ main {
182203
td {
183204
@apply relative
184205
block
206+
border-0
185207
border-b
208+
px-0
186209
py-2
187210
pl-[33%]
188211
text-right
@@ -203,22 +226,5 @@ main {
203226
dark:before:text-neutral-200;
204227
}
205228
}
206-
207-
th {
208-
@apply font-semibold;
209-
}
210-
211-
tr:last-child > td {
212-
@apply sm:border-b-0;
213-
214-
&:last-child {
215-
@apply max-xs:border-b-0;
216-
}
217-
}
218-
219-
td:first-child,
220-
th:first-child {
221-
@apply sm:border-l-0;
222-
}
223229
}
224230
}

0 commit comments

Comments
 (0)