Skip to content

Commit feab0c6

Browse files
fix(site/VerdictExplanation): accent strip spans the whole card
The colored severity strip was a flex child of <header>, so it only extended as far as the header did. Visually it read as a colored cap above the rules instead of a band marking the card's severity. Pulled the strip up to be a flex child of <article> itself, and moved the header and rules list into a single content wrapper next to it. With the article using flex and the default align-items:stretch, the strip now runs the full card height. Also added a 1px coder-smoke/60 border between the header and the first rule. Without it the rule list ran right into the title with no visible separator.
1 parent 10b2473 commit feab0c6

1 file changed

Lines changed: 49 additions & 45 deletions

File tree

site/src/components/VerdictExplanation/VerdictExplanation.tsx

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -312,57 +312,61 @@ const CategoryCard: FC<CategoryCardProps> = ({ group }) => {
312312
return (
313313
<article
314314
id={slugifyCategory(group.category)}
315-
className="break-inside-avoid overflow-hidden rounded-md border border-coder-smoke bg-coder-cinder/60"
315+
className="flex break-inside-avoid overflow-hidden rounded-md border border-coder-smoke bg-coder-cinder/60"
316316
>
317-
<header className="flex items-stretch">
318-
<span
319-
aria-hidden
320-
className={cn("w-1.5 shrink-0", accent.accent)}
321-
/>
322-
<div className="flex flex-1 flex-wrap items-center justify-between gap-x-4 gap-y-1.5 px-3 py-2.5">
317+
{/* The accent strip lives at the article level so flex stretches
318+
it to the full card height. Previously it lived inside the
319+
header and stopped where the header ended, which read as a
320+
decorative cap rather than a severity band. */}
321+
<span
322+
aria-hidden
323+
className={cn("w-1.5 shrink-0", accent.accent)}
324+
/>
325+
<div className="flex-1">
326+
<header className="flex flex-wrap items-center justify-between gap-x-4 gap-y-1.5 px-3 py-2.5">
323327
<h4 className="text-sm font-semibold text-coder-neutral-100">
324328
{group.category}
325329
</h4>
326330
<SeverityBadges counts={group.bySeverity} />
327-
</div>
328-
</header>
329-
<ul className="divide-y divide-coder-smoke/40">
330-
{group.rules.map((rule) => {
331-
const tone = SEVERITY_TONE[rule.severity];
332-
return (
333-
<li key={rule.id} className="space-y-1 px-3 py-2.5">
334-
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-xs">
335-
<span
336-
aria-hidden
337-
className={cn("size-2 shrink-0 rounded-full", tone.dot)}
338-
/>
339-
<span className="font-mono font-medium text-coder-neutral-100">
340-
{rule.id}
341-
</span>
342-
<span
343-
className={cn(
344-
"font-mono uppercase tracking-wide",
345-
tone.text,
346-
)}
347-
>
348-
{rule.severity}
349-
</span>
350-
<span className="font-mono text-coder-neutral-500">
351-
{"\u00b7"} {rule.count}{" "}
352-
{rule.count === 1 ? "hit" : "hits"}
353-
</span>
354-
</div>
355-
<p className="text-xs leading-relaxed text-coder-neutral-300">
356-
{rule.description || (
357-
<span className="text-coder-neutral-500">
358-
(no description in the bundled rule catalogue)
331+
</header>
332+
<ul className="divide-y divide-coder-smoke/40 border-t border-coder-smoke/60">
333+
{group.rules.map((rule) => {
334+
const tone = SEVERITY_TONE[rule.severity];
335+
return (
336+
<li key={rule.id} className="space-y-1 px-3 py-2.5">
337+
<div className="flex flex-wrap items-center gap-x-2 gap-y-1 text-xs">
338+
<span
339+
aria-hidden
340+
className={cn("size-2 shrink-0 rounded-full", tone.dot)}
341+
/>
342+
<span className="font-mono font-medium text-coder-neutral-100">
343+
{rule.id}
359344
</span>
360-
)}
361-
</p>
362-
</li>
363-
);
364-
})}
365-
</ul>
345+
<span
346+
className={cn(
347+
"font-mono uppercase tracking-wide",
348+
tone.text,
349+
)}
350+
>
351+
{rule.severity}
352+
</span>
353+
<span className="font-mono text-coder-neutral-500">
354+
{"\u00b7"} {rule.count}{" "}
355+
{rule.count === 1 ? "hit" : "hits"}
356+
</span>
357+
</div>
358+
<p className="text-xs leading-relaxed text-coder-neutral-300">
359+
{rule.description || (
360+
<span className="text-coder-neutral-500">
361+
(no description in the bundled rule catalogue)
362+
</span>
363+
)}
364+
</p>
365+
</li>
366+
);
367+
})}
368+
</ul>
369+
</div>
366370
</article>
367371
);
368372
};

0 commit comments

Comments
 (0)