Skip to content

Commit 199bd92

Browse files
committed
chore: cleanup
1 parent a8ecfd4 commit 199bd92

File tree

8 files changed

+50
-27
lines changed

8 files changed

+50
-27
lines changed

site/src/components/Alert/Alert.tsx

Lines changed: 45 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { cva, type VariantProps } from "class-variance-authority";
22
import { Button } from "components/Button/Button";
3+
import {
4+
CircleAlertIcon,
5+
CircleCheckIcon,
6+
InfoIcon,
7+
TriangleAlertIcon,
8+
XIcon,
9+
} from "lucide-react";
310
import {
411
type FC,
512
forwardRef,
@@ -14,27 +21,34 @@ const alertVariants = cva(
1421
{
1522
variants: {
1623
variant: {
17-
default: "border-border-default",
18-
info: "border-highlight-sky",
19-
success: "border-surface-green",
20-
warning: "border-border-warning",
21-
error: "border-border-destructive",
24+
default: "border-border-default bg-surface-secondary",
25+
info: "border-border-pending bg-surface-secondary",
26+
success: "border-border-green bg-surface-green",
27+
warning: "border-border-warning bg-surface-orange",
28+
error: "border-border-destructive bg-surface-red",
2229
},
2330
},
2431
defaultVariants: {
2532
variant: "default",
2633
},
27-
}
28-
)
34+
},
35+
);
2936

30-
// Map MUI severity to our variant
3137
const severityToVariant = {
3238
info: "info",
3339
success: "success",
3440
warning: "warning",
3541
error: "error",
3642
} as const;
3743

44+
const variantIcons = {
45+
default: { icon: InfoIcon, className: "text-content-secondary" },
46+
info: { icon: InfoIcon, className: "text-highlight-sky" },
47+
success: { icon: CircleCheckIcon, className: "text-content-success" },
48+
warning: { icon: TriangleAlertIcon, className: "text-content-warning" },
49+
error: { icon: CircleAlertIcon, className: "text-content-destructive" },
50+
} as const;
51+
3852
export type AlertColor = "info" | "success" | "warning" | "error";
3953

4054
export type AlertProps = {
@@ -67,29 +81,40 @@ export const Alert: FC<AlertProps> = ({
6781
variant ||
6882
(severity in severityToVariant ? severityToVariant[severity] : "default");
6983

84+
const { icon: Icon, className: iconClassName } = variantIcons[finalVariant];
85+
7086
return (
7187
<div
7288
role="alert"
7389
className={cn(alertVariants({ variant: finalVariant }), className)}
7490
{...props}
7591
>
76-
<div className="flex items-start justify-between text-sm">
77-
<div className="flex-1">{children}</div>
78-
<div className="flex items-center gap-2 ml-4">
79-
{/* CTAs passed in by the consumer */}
92+
<div className="flex items-start justify-between gap-4 text-sm">
93+
<div className="flex flex-row items-start gap-3">
94+
<Icon
95+
className={cn(
96+
"size-icon-sm mt-1",
97+
iconClassName,
98+
)}
99+
/>
100+
<div className="flex-1">{children}</div>
101+
</div>
102+
<div className="flex items-start gap-2">
80103
{actions}
81104

82105
{dismissible && (
83106
<Button
84107
variant="subtle"
85-
size="sm"
108+
size="icon"
109+
className="mt-px !size-auto !min-w-0 !p-0"
86110
onClick={() => {
87111
setOpen(false);
88112
onDismiss?.();
89113
}}
90114
data-testid="dismiss-banner-btn"
115+
aria-label="Dismiss"
91116
>
92-
Dismiss
117+
<XIcon className="!size-icon-sm !p-0" />
93118
</Button>
94119
)}
95120
</div>
@@ -100,22 +125,22 @@ export const Alert: FC<AlertProps> = ({
100125

101126
export const AlertDetail: FC<PropsWithChildren> = ({ children }) => {
102127
return (
103-
<span className="text-sm opacity-75" data-chromatic="ignore">
128+
<span className="m-0 text-sm" data-chromatic="ignore">
104129
{children}
105130
</span>
106131
);
107132
};
108133

109-
// Export AlertTitle and AlertDescription for compatibility
110134
export const AlertTitle = forwardRef<
111135
HTMLHeadingElement,
112136
React.HTMLAttributes<HTMLHeadingElement>
113137
>(({ className, ...props }, ref) => (
114-
<h5
138+
<h1
115139
ref={ref}
116-
className={cn("mb-1 font-medium leading-none tracking-tight", className)}
140+
className={cn(
141+
"m-0 mb-1 text-sm font-medium",
142+
className,
143+
)}
117144
{...props}
118145
/>
119146
));
120-
121-
AlertTitle.displayName = "AlertTitle";

site/src/components/Badge/Badge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const badgeVariants = cva(
2424
"border border-solid border-border-destructive bg-surface-red text-highlight-red shadow",
2525
green:
2626
"border border-solid border-border-green bg-surface-green text-highlight-green shadow",
27-
info: "border border-solid border-border-sky bg-surface-sky text-highlight-sky shadow",
27+
info: "border border-solid border-border-pending bg-surface-sky text-highlight-sky shadow",
2828
},
2929
size: {
3030
xs: "text-2xs font-regular h-5 [&_svg]:hidden rounded px-1.5",

site/src/components/GitDeviceAuth/GitDeviceAuth.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type { Interpolation, Theme } from "@emotion/react";
2-
32
import CircularProgress from "@mui/material/CircularProgress";
43
import Link from "@mui/material/Link";
54
import type { ApiErrorResponse } from "api/errors";

site/src/modules/workspaces/WorkspaceMoreActions/ChangeWorkspaceVersionDialog.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { css } from "@emotion/css";
2-
32
import Autocomplete from "@mui/material/Autocomplete";
43
import CircularProgress from "@mui/material/CircularProgress";
54
import TextField from "@mui/material/TextField";

site/src/pages/WorkspacePage/WorkspaceNotifications/Notifications.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const NotificationItem: FC<NotificationItemProps> = ({ notification }) => {
105105
};
106106

107107
export const NotificationActionButton: FC<ButtonProps> = (props) => {
108-
return <Button variant="outline" size="sm" {...props} />;
108+
return <Button variant="default" size="sm" {...props} />;
109109
};
110110

111111
const styles = {

site/src/pages/WorkspaceSettingsPage/WorkspaceParametersPage/WorkspaceParametersPageViewExperimental.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const WorkspaceParametersPageViewExperimental: FC<
120120

121121
{hasIncompatibleParameters && (
122122
<Alert severity="error">
123-
<p className="text-lg leading-tight font-bold m-0">
123+
<p className="text-lg leading-normal font-bold m-0">
124124
Workspace update blocked
125125
</p>
126126
<p className="mb-0">

site/src/pages/WorkspaceSettingsPage/WorkspaceSchedulePage/WorkspaceSchedulePage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const WorkspaceSchedulePage: FC = () => {
109109
>
110110
Prebuilt Workspaces Scheduling
111111
</Link>
112-
documentation page.
112+
{" "}documentation page.
113113
</Alert>
114114
) : (
115115
<WorkspaceScheduleForm

site/tailwind.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ module.exports = {
5959
DEFAULT: "hsl(var(--border-default))",
6060
warning: "hsl(var(--border-warning))",
6161
green: "hsl(var(--border-green))",
62-
sky: "hsl(var(--border-sky))",
62+
pending: "hsl(var(--border-sky))",
6363
destructive: "hsl(var(--border-destructive))",
6464
success: "hsl(var(--border-success))",
6565
hover: "hsl(var(--border-hover))",

0 commit comments

Comments
 (0)