fix(web): add glass composer alerts
This commit is contained in:
1 parent
5961d36769
commit
d330759f58
3 files changed
+43
-3
No files matched your search
@@ -33,6 +33,10 @@ describe("ComposerBannerStack", () => {
|
||||
const markup = renderToStaticMarkup(<ComposerBannerStack items={[banner("front")]} />);
|
||||
|
||||
expect(markup).not.toContain("data-composer-banner-stack-expanded-items");
|
||||
expect(markup).toContain("alert-glass");
|
||||
expect(markup).toContain('data-variant="warning"');
|
||||
expect(markup).toContain("transform:none");
|
||||
expect(markup).not.toContain("will-change:transform");
|
||||
});
|
||||
|
||||
it("applies item-specific surface and action layout classes", () => {
|
||||
|
||||
@@ -16,11 +16,10 @@ const stackedExitStyle = {
|
||||
} satisfies CSSProperties;
|
||||
const restingStyle = {
|
||||
opacity: 1,
|
||||
transform: "translate3d(0, 0, 0)",
|
||||
transform: "none",
|
||||
} satisfies CSSProperties;
|
||||
const exitTransitionStyle = {
|
||||
transition: `transform ${DISMISS_TRANSITION_MS}ms ease-in, opacity ${DISMISS_TRANSITION_MS}ms ease-in`,
|
||||
willChange: "transform, opacity",
|
||||
} satisfies CSSProperties;
|
||||
|
||||
export interface ComposerBannerStackItem {
|
||||
@@ -173,7 +172,11 @@ function ComposerBannerStackAlert({
|
||||
const dismissOnly = item.onDismiss && !item.actions;
|
||||
|
||||
return (
|
||||
<Alert variant={item.variant} className={item.className}>
|
||||
<Alert
|
||||
variant={item.variant}
|
||||
className={cn("alert-glass", item.className)}
|
||||
data-variant={item.variant}
|
||||
>
|
||||
{item.icon}
|
||||
<AlertTitle>{item.title}</AlertTitle>
|
||||
{item.description ? <AlertDescription>{item.description}</AlertDescription> : null}
|
||||
|
||||
@@ -375,6 +375,35 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
|
||||
.alert-glass {
|
||||
--alert-glass-tint: transparent;
|
||||
|
||||
background:
|
||||
linear-gradient(
|
||||
color-mix(in srgb, var(--alert-glass-tint) 4%, transparent),
|
||||
color-mix(in srgb, var(--alert-glass-tint) 4%, transparent)
|
||||
),
|
||||
color-mix(in srgb, var(--background) var(--glass-opacity), transparent) !important;
|
||||
-webkit-backdrop-filter: blur(16px) saturate(1.1);
|
||||
backdrop-filter: blur(16px) saturate(1.1);
|
||||
}
|
||||
|
||||
.alert-glass[data-variant="error"] {
|
||||
--alert-glass-tint: var(--destructive);
|
||||
}
|
||||
|
||||
.alert-glass[data-variant="info"] {
|
||||
--alert-glass-tint: var(--info);
|
||||
}
|
||||
|
||||
.alert-glass[data-variant="success"] {
|
||||
--alert-glass-tint: var(--success);
|
||||
}
|
||||
|
||||
.alert-glass[data-variant="warning"] {
|
||||
--alert-glass-tint: var(--warning);
|
||||
}
|
||||
|
||||
.dropdown-glass,
|
||||
.dialog-glass,
|
||||
.workflow-dialog-surface,
|
||||
@@ -566,6 +595,10 @@ html[data-mobile-composer-route-transition="true"]::view-transition-old(t3-mobil
|
||||
|
||||
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
|
||||
.chat-composer-glass,
|
||||
.alert-glass {
|
||||
background: var(--background) !important;
|
||||
}
|
||||
|
||||
.chat-composer-glass-host {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user