Skip to content

Commit 2b4b530

Browse files
feat(ui): restyle Callout to GitHub admonition anatomy
Drops the tinted surface and outer border for a plain 3px left rule; the icon + label line is tinted in the tone color and the body renders in the regular foreground. Important now uses the speech-bubble icon (MessageSquareWarning) instead of duplicating Info. API unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 7ff473a commit 2b4b530

1 file changed

Lines changed: 17 additions & 18 deletions

File tree

packages/ui/src/components/callout.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as React from "react";
2-
import { Info, Lightbulb, TriangleAlert, OctagonAlert } from "lucide-react";
2+
import { Info, Lightbulb, MessageSquareWarning, TriangleAlert, OctagonAlert } from "lucide-react";
33
import { cn } from "../lib/utils";
44

55
/**
6-
* Callout — composite. GFM-style admonition matching the Elide docs content
7-
* (Note / Tip / Important / Warning / Caution). Each tone carries its own hue,
8-
* left accent rule, and icon. Body accepts arbitrary rich content.
6+
* Callout — composite. GitHub-style admonition (Note / Tip / Important /
7+
* Warning / Caution): a plain left rule with the icon + label line tinted in
8+
* the tone color, no surface fill or outer border. Body accepts arbitrary
9+
* rich content and renders in the regular foreground color.
910
*/
1011
type CalloutTone = "note" | "tip" | "important" | "warning" | "caution";
1112

@@ -15,7 +16,7 @@ const TONES: Record<
1516
> = {
1617
note: { label: "Note", color: "var(--eld-info)", icon: Info },
1718
tip: { label: "Tip", color: "var(--eld-success)", icon: Lightbulb },
18-
important: { label: "Important", color: "var(--eld-magenta-500)", icon: Info },
19+
important: { label: "Important", color: "var(--eld-magenta-500)", icon: MessageSquareWarning },
1920
warning: { label: "Warning", color: "var(--eld-warning)", icon: TriangleAlert },
2021
caution: { label: "Caution", color: "var(--eld-danger)", icon: OctagonAlert },
2122
};
@@ -32,21 +33,19 @@ export function Callout({ tone = "note", title, className, children, ...props }:
3233
return (
3334
<div
3435
role="note"
35-
className={cn("flex gap-3 rounded-xl border p-4", className)}
36-
style={{
37-
// tone-tinted surface + left accent, expressed off the tone color
38-
background: `color-mix(in oklab, ${t.color} 9%, transparent)`,
39-
borderColor: `color-mix(in oklab, ${t.color} 25%, transparent)`,
40-
borderLeft: `3px solid ${t.color}`,
41-
}}
36+
className={cn("flex flex-col gap-2 py-2 pl-4 pr-2", className)}
37+
style={{ borderLeft: `3px solid ${t.color}` }}
4238
{...props}
4339
>
44-
<Icon className="mt-0.5 h-[18px] w-[18px] shrink-0" style={{ color: t.color } as React.CSSProperties} />
45-
<div className="min-w-0">
46-
<div className="mb-1 text-sm font-bold text-foreground">{title ?? t.label}</div>
47-
<div className="text-sm leading-relaxed text-muted-foreground [&_code]:font-mono [&_code]:text-[var(--primary-emphasis)]">
48-
{children}
49-
</div>
40+
<div
41+
className="flex items-center gap-2 text-sm font-semibold leading-none"
42+
style={{ color: t.color }}
43+
>
44+
<Icon className="h-4 w-4 shrink-0" />
45+
{title ?? t.label}
46+
</div>
47+
<div className="text-sm leading-relaxed text-foreground [&_code]:font-mono [&_code]:text-[var(--primary-emphasis)]">
48+
{children}
5049
</div>
5150
</div>
5251
);

0 commit comments

Comments
 (0)