Skip to content

Commit 8c21f0e

Browse files
committed
refactor alert dialog styles, use vscode theme
1 parent 9dfdc42 commit 8c21f0e

File tree

2 files changed

+47
-21
lines changed

2 files changed

+47
-21
lines changed

webview-ui/src/components/settings/SettingsView.tsx

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
import { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react"
22
import { Button as VSCodeButton } from "vscrui"
3-
import { CheckCheck, SquareMousePointer, Webhook, GitBranch, Bell, Cog, FlaskConical } from "lucide-react"
3+
import {
4+
CheckCheck,
5+
SquareMousePointer,
6+
Webhook,
7+
GitBranch,
8+
Bell,
9+
Cog,
10+
FlaskConical,
11+
AlertTriangle,
12+
} from "lucide-react"
413

514
import { ApiConfiguration } from "../../../../src/shared/api"
615
import { ExperimentId } from "../../../../src/shared/experiments"
@@ -419,15 +428,17 @@ const SettingsView = forwardRef<SettingsViewRef, SettingsViewProps>(({ onDone },
419428
<AlertDialog open={isDiscardDialogShow} onOpenChange={setDiscardDialogShow}>
420429
<AlertDialogContent>
421430
<AlertDialogHeader>
422-
<AlertDialogTitle>Unsaved changes</AlertDialogTitle>
423-
<AlertDialogDescription>
424-
<span className={`codicon codicon-warning align-middle mr-1`} />
425-
Do you want to discard changes and continue?
426-
</AlertDialogDescription>
431+
<AlertDialogTitle>
432+
<AlertTriangle className="w-5 h-5 text-yellow-500" />
433+
Unsaved Changes
434+
</AlertDialogTitle>
435+
<AlertDialogDescription>Do you want to discard changes and continue?</AlertDialogDescription>
427436
</AlertDialogHeader>
428437
<AlertDialogFooter>
429-
<AlertDialogAction onClick={() => onConfirmDialogResult(true)}>Yes</AlertDialogAction>
430-
<AlertDialogCancel onClick={() => onConfirmDialogResult(false)}>No</AlertDialogCancel>
438+
<AlertDialogCancel onClick={() => onConfirmDialogResult(false)}>Cancel</AlertDialogCancel>
439+
<AlertDialogAction onClick={() => onConfirmDialogResult(true)}>
440+
Discard changes
441+
</AlertDialogAction>
431442
</AlertDialogFooter>
432443
</AlertDialogContent>
433444
</AlertDialog>

webview-ui/src/components/ui/alert-dialog.tsx

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof
3636
<AlertDialogPrimitive.Content
3737
data-slot="alert-dialog-content"
3838
className={cn(
39-
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg",
39+
"bg-vscode-editor-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-3 rounded-sm border border-vscode-panel-border p-4 shadow-lg duration-200 sm:max-w-md",
4040
className,
4141
)}
4242
{...props}
@@ -46,20 +46,14 @@ function AlertDialogContent({ className, ...props }: React.ComponentProps<typeof
4646
}
4747

4848
function AlertDialogHeader({ className, ...props }: React.ComponentProps<"div">) {
49-
return (
50-
<div
51-
data-slot="alert-dialog-header"
52-
className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
53-
{...props}
54-
/>
55-
)
49+
return <div data-slot="alert-dialog-header" className={cn("flex flex-col gap-1 text-left", className)} {...props} />
5650
}
5751

5852
function AlertDialogFooter({ className, ...props }: React.ComponentProps<"div">) {
5953
return (
6054
<div
6155
data-slot="alert-dialog-footer"
62-
className={cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className)}
56+
className={cn("flex flex-row justify-end gap-2 mt-4", className)}
6357
{...props}
6458
/>
6559
)
@@ -69,7 +63,10 @@ function AlertDialogTitle({ className, ...props }: React.ComponentProps<typeof A
6963
return (
7064
<AlertDialogPrimitive.Title
7165
data-slot="alert-dialog-title"
72-
className={cn("text-lg font-semibold", className)}
66+
className={cn(
67+
"text-base font-medium text-vscode-editor-foreground flex items-center gap-2 text-left",
68+
className,
69+
)}
7370
{...props}
7471
/>
7572
)
@@ -82,18 +79,36 @@ function AlertDialogDescription({
8279
return (
8380
<AlertDialogPrimitive.Description
8481
data-slot="alert-dialog-description"
85-
className={cn("text-muted-foreground text-sm", className)}
82+
className={cn("text-vscode-descriptionForeground text-sm text-left", className)}
8683
{...props}
8784
/>
8885
)
8986
}
9087

9188
function AlertDialogAction({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
92-
return <AlertDialogPrimitive.Action className={cn(buttonVariants(), className)} {...props} />
89+
return (
90+
<AlertDialogPrimitive.Action
91+
className={cn(
92+
buttonVariants(),
93+
"bg-vscode-button-background text-vscode-button-foreground hover:bg-vscode-button-hoverBackground border border-transparent h-6 px-3 py-1",
94+
className,
95+
)}
96+
{...props}
97+
/>
98+
)
9399
}
94100

95101
function AlertDialogCancel({ className, ...props }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
96-
return <AlertDialogPrimitive.Cancel className={cn(buttonVariants({ variant: "outline" }), className)} {...props} />
102+
return (
103+
<AlertDialogPrimitive.Cancel
104+
className={cn(
105+
buttonVariants({ variant: "outline" }),
106+
"bg-vscode-button-secondaryBackground text-vscode-button-secondaryForeground hover:bg-vscode-button-secondaryHoverBackground border border-vscode-button-border h-6 px-3 py-1",
107+
className,
108+
)}
109+
{...props}
110+
/>
111+
)
97112
}
98113

99114
export {

0 commit comments

Comments
 (0)