Skip to content

Commit b4cfac2

Browse files
committed
feat(apollo-vertex): remove subtle visual variant and align tinted description
1 parent f2dd88b commit b4cfac2

6 files changed

Lines changed: 37 additions & 63 deletions

File tree

apps/apollo-vertex/app/patterns/notifications/in-product/notification-examples.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ export function AlertExamples() {
8080
<InfoIcon className="h-4 w-4" />
8181
<AlertTitle>New version available</AlertTitle>
8282
<AlertDescription>
83-
A new version of the platform is ready. Review the changelog for details.
83+
A new version of the platform is ready. Review the changelog for
84+
details.
8485
</AlertDescription>
8586
</Alert>
8687

@@ -112,7 +113,7 @@ function DismissibleAlert({
112113
}: {
113114
children: ReactNode;
114115
status: "default" | "warning" | "error";
115-
visual?: "outline" | "tinted" | "subtle";
116+
visual?: "outline" | "tinted";
116117
}) {
117118
const [visible, setVisible] = useState(true);
118119
if (!visible) return null;

apps/apollo-vertex/app/patterns/notifications/in-product/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ Inline alerts support two visual styles. Choose based on the urgency and importa
134134
135135
#### Default (tinted)
136136

137-
Low-opacity status background with neutral title text. Use for critical messages that demand immediate attention or block progress.
137+
Low-opacity status background with neutral title text. Use for persistent, non-dismissible messages, from routine updates and background info to blocking errors.
138138

139139
<div className="p-4 border rounded-lg mt-4">
140140
<AlertExamples />
@@ -332,7 +332,7 @@ Avoid driving users away from their workflow unless necessary.
332332

333333
| Question | Answer | Style |
334334
|---|---|---|
335-
| Is the message routine, informational, or requires immediate attention? | Yes | Default (tinted) |
335+
| Is the message routine, informational, or does it require immediate attention? | Yes | Default (tinted) |
336336
| Is the message contextual, a warning, or an unresolved requirement? | Yes | Accent (outline) |
337337

338338
> When unsure, use **default**. Use Accent only when the message needs a distinct visual call-out.

apps/apollo-vertex/app/shadcn-components/alert/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Displays a callout for user attention.
1111

1212
### Default (tinted)
1313

14-
Low-opacity status background with neutral title text. Use for critical messages that demand immediate attention.
14+
Low-opacity status background with neutral title text. Use for persistent messages, from routine updates to blocking errors.
1515

1616
<div className="p-4 border rounded-lg mt-4">
1717
<AlertExamples />
@@ -66,7 +66,7 @@ import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"
6666
| Prop | Type | Default | Description |
6767
|---|---|---|---|
6868
| `status` | `"default" \| "warning" \| "error"` || Sets the semantic status color |
69-
| `visual` | `"outline" \| "tinted" \| "subtle"` || Sets the visual treatment |
69+
| `visual` | `"outline" \| "tinted"` || Sets the visual treatment |
7070
| `variant` | `"default" \| "destructive"` | `"default"` | Legacy shadcn variant (use `status` + `visual` instead) |
7171

7272
## Complex alert patterns (edge cases)

apps/apollo-vertex/app/shadcn-components/sonner/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ toast.error("Upload failed", {
6868
| `duration` | `number` | `5000` | Auto-dismiss delay in milliseconds |
6969
| `closeButton` | `boolean` | `true` | Show a close button on each toast |
7070
| `theme` | `"light" \| "dark" \| "system"` | `"system"` | Color theme — defaults to the current app theme via `next-themes` |
71-
| `toastOptions` | `ToastOptions` || Global options applied to all toasts (classNames, style, etc.) |
71+
| `toastOptions` | `ToasterProps["toastOptions"]` || Global options applied to all toasts (classNames, style, etc.) |
7272

7373
## Toast function options
7474

apps/apollo-vertex/registry/alert/alert.tsx

Lines changed: 14 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const alertVariants = cva(
2020
visual: {
2121
outline: "bg-card",
2222
tinted: "border-transparent",
23-
subtle: "",
2423
},
2524
},
2625
compoundVariants: [
@@ -33,7 +32,8 @@ const alertVariants = cva(
3332
{
3433
status: "warning",
3534
visual: "outline",
36-
className: "border-warning [&>svg]:text-warning-foreground dark:[&>svg]:text-warning",
35+
className:
36+
"border-warning [&>svg]:text-warning-foreground dark:[&>svg]:text-warning",
3737
},
3838
{
3939
status: "error",
@@ -45,7 +45,8 @@ const alertVariants = cva(
4545
{
4646
status: "default",
4747
visual: "tinted",
48-
className: "bg-badge/20 border-transparent text-foreground [&>svg]:text-foreground",
48+
className:
49+
"bg-badge/20 border-transparent text-foreground [&>svg]:text-foreground",
4950
},
5051
{
5152
status: "warning",
@@ -56,24 +57,8 @@ const alertVariants = cva(
5657
{
5758
status: "error",
5859
visual: "tinted",
59-
className: "bg-destructive/10 dark:bg-destructive/25 text-foreground [&>svg]:text-destructive",
60-
},
61-
62-
// subtle — status-colored icon + title (title color applied via AlertContext)
63-
{
64-
status: "default",
65-
visual: "subtle",
66-
className: "[&>svg]:text-foreground",
67-
},
68-
{
69-
status: "warning",
70-
visual: "subtle",
71-
className: "[&>svg]:text-warning-foreground dark:[&>svg]:text-warning",
72-
},
73-
{
74-
status: "error",
75-
visual: "subtle",
76-
className: "[&>svg]:text-destructive",
60+
className:
61+
"bg-destructive/10 dark:bg-destructive/25 text-foreground [&>svg]:text-destructive",
7762
},
7863
],
7964
defaultVariants: {
@@ -82,13 +67,6 @@ const alertVariants = cva(
8267
},
8368
);
8469

85-
interface AlertContextValue {
86-
status?: "default" | "warning" | "error" | null;
87-
visual?: "outline" | "tinted" | "subtle" | null;
88-
}
89-
90-
const AlertContext = React.createContext<AlertContextValue>({});
91-
9270
interface AlertProps
9371
extends React.ComponentProps<"div">,
9472
VariantProps<typeof alertVariants> {}
@@ -102,36 +80,23 @@ function Alert({
10280
...props
10381
}: AlertProps) {
10482
return (
105-
<AlertContext.Provider value={{ status, visual }}>
106-
<div
107-
data-slot="alert"
108-
role="alert"
109-
className={cn(alertVariants({ variant, status, visual }), className)}
110-
{...props}
111-
>
112-
{children}
113-
</div>
114-
</AlertContext.Provider>
83+
<div
84+
data-slot="alert"
85+
role="alert"
86+
className={cn(alertVariants({ variant, status, visual }), className)}
87+
{...props}
88+
>
89+
{children}
90+
</div>
11591
);
11692
}
11793

118-
// Title colors for the subtle visual variant, keyed by status
119-
const subtleTitleColors: Record<string, string> = {
120-
default: "text-foreground",
121-
warning: "text-warning-foreground dark:text-warning",
122-
error: "text-destructive",
123-
};
124-
12594
function AlertTitle({ className, ...props }: React.ComponentProps<"div">) {
126-
const { status, visual } = React.useContext(AlertContext);
127-
const colorClass =
128-
visual === "subtle" && status ? (subtleTitleColors[status] ?? "") : "";
12995
return (
13096
<div
13197
data-slot="alert-title"
13298
className={cn(
13399
"col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",
134-
colorClass,
135100
className,
136101
)}
137102
{...props}

apps/apollo-vertex/registry/sonner/sonner.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,29 @@ import {
1010
import { useTheme } from "next-themes";
1111
import { Toaster as Sonner, type ToasterProps } from "sonner";
1212

13-
// Shared icon alignment: top-align icons with the first line of toast text
13+
// Shared icon alignment: top-align icons with the first line of toast text.
1414
const iconAlign = "[&>[data-icon]]:!items-start [&>[data-icon]>svg]:!mt-0.5";
1515

16+
// Text color for icon, title, description, and close button in status toasts.
17+
// Light: dark ink (oklch(0.166 0.0283 203.34)) on tinted background; Dark: foreground token.
18+
const statusTextClasses =
19+
"[&>[data-icon]>svg]:!text-[oklch(0.166_0.0283_203.34)] dark:[&>[data-icon]>svg]:!text-foreground " +
20+
"[&_[data-title]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-title]]:!text-foreground " +
21+
"[&_[data-description]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-description]]:!text-foreground " +
22+
"[&_[data-close-button]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-close-button]]:!text-foreground";
23+
1624
// Apollo status styles for Sonner toasts.
17-
// Light: inverted card surface (info) or status-tinted background; matching icon color.
18-
// Dark: inverted secondary surface (info) or status-tinted color-mix with popover.
25+
// Light: inverted card-foreground background (info) or status-tinted background; matching icon color.
26+
// Dark: inverted card-foreground background (info) or status-tinted color-mix with popover.
1927
export const apolloToastClassNames: NonNullable<
2028
NonNullable<ToasterProps["toastOptions"]>["classNames"]
2129
> = {
2230
info: `!border-info !bg-card-foreground dark:!bg-card-foreground [&>[data-icon]>svg]:!text-primary-foreground [&_[data-title]]:!text-primary-foreground [&_[data-description]]:!text-primary-foreground [&_[data-close-button]]:!text-primary-foreground ${iconAlign}`,
23-
success: `!border-success !bg-[color-mix(in_srgb,var(--success)_25%,var(--card)_75%)] dark:!bg-[color-mix(in_srgb,var(--success)_25%,var(--popover)_75%)] [&>[data-icon]>svg]:!text-[oklch(0.166_0.0283_203.34)] dark:[&>[data-icon]>svg]:!text-foreground [&_[data-title]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-title]]:!text-foreground [&_[data-description]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-description]]:!text-foreground [&_[data-close-button]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-close-button]]:!text-foreground ${iconAlign}`,
24-
warning: `!border-warning !bg-[color-mix(in_srgb,var(--warning)_60%,var(--card)_40%)] dark:!bg-[color-mix(in_srgb,var(--warning)_60%,var(--popover)_40%)] [&>[data-icon]>svg]:!text-[oklch(0.166_0.0283_203.34)] dark:[&>[data-icon]>svg]:!text-foreground [&_[data-title]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-title]]:!text-foreground [&_[data-description]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-description]]:!text-foreground [&_[data-close-button]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-close-button]]:!text-foreground ${iconAlign}`,
25-
error: `!border-destructive !bg-[color-mix(in_srgb,var(--destructive)_50%,var(--card)_50%)] dark:!bg-[color-mix(in_srgb,var(--destructive)_50%,var(--popover)_50%)] [&>[data-icon]>svg]:!text-[oklch(0.166_0.0283_203.34)] dark:[&>[data-icon]>svg]:!text-foreground [&_[data-title]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-title]]:!text-foreground [&_[data-description]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-description]]:!text-foreground [&_[data-close-button]]:!text-[oklch(0.166_0.0283_203.34)] dark:[&_[data-close-button]]:!text-foreground ${iconAlign}`,
31+
success: `!border-success !bg-[color-mix(in_srgb,var(--success)_25%,var(--card)_75%)] dark:!bg-[color-mix(in_srgb,var(--success)_25%,var(--popover)_75%)] ${statusTextClasses} ${iconAlign}`,
32+
warning: `!border-warning !bg-[color-mix(in_srgb,var(--warning)_60%,var(--card)_40%)] dark:!bg-[color-mix(in_srgb,var(--warning)_60%,var(--popover)_40%)] ${statusTextClasses} ${iconAlign}`,
33+
error: `!border-destructive !bg-[color-mix(in_srgb,var(--destructive)_50%,var(--card)_50%)] dark:!bg-[color-mix(in_srgb,var(--destructive)_50%,var(--popover)_50%)] ${statusTextClasses} ${iconAlign}`,
2634
closeButton:
27-
'!left-auto !right-2 !top-2 !transform-none !border-none !bg-transparent !rounded-sm',
35+
"!left-auto !right-2 !top-2 !transform-none !border-none !bg-transparent !rounded-sm",
2836
};
2937

3038
const Toaster = ({ ...props }: ToasterProps) => {

0 commit comments

Comments
 (0)