Skip to content

Commit a440fed

Browse files
committed
Improve the shortcut esc key on dialog and sheet component
1 parent ac5209f commit a440fed

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

apps/webapp/app/components/primitives/Dialog.tsx

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,20 @@ const DialogContent = React.forwardRef<
5050
>
5151
<hr className="absolute left-0 top-11 w-full" />
5252
{children}
53-
<DialogPrimitive.Close className="data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-3 top-2 rounded-sm py-1 pr-1 opacity-70 transition-opacity focus-custom hover:opacity-100 disabled:pointer-events-none">
54-
<div className="flex gap-x-2">
55-
<ShortcutKey
56-
shortcut={{
57-
windows: {
58-
key: "esc",
59-
},
60-
mac: {
61-
key: "esc",
62-
},
63-
}}
64-
variant={"small"}
65-
/>
66-
<XMarkIcon className="h-5 w-5" />
67-
<span className="sr-only">Close</span>
68-
</div>
53+
<DialogPrimitive.Close className="data-[state=open]:bg-accent data-[state=open]:text-muted-foreground group absolute right-2 top-[0.5625rem] flex items-center gap-1 rounded-sm p-1 py-1 pl-0 pr-1 opacity-70 transition focus-custom hover:bg-charcoal-750 hover:opacity-100 focus-visible:focus-custom disabled:pointer-events-none">
54+
<ShortcutKey
55+
shortcut={{
56+
windows: {
57+
key: "esc",
58+
},
59+
mac: {
60+
key: "esc",
61+
},
62+
}}
63+
variant="medium"
64+
/>
65+
<XMarkIcon className="size-4 text-text-dimmed transition group-hover:text-text-bright" />
66+
<span className="sr-only">Close</span>
6967
</DialogPrimitive.Close>
7068
</DialogPrimitive.Content>
7169
</DialogPortal>

apps/webapp/app/components/primitives/SheetV3.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,17 @@ const SheetTitle = React.forwardRef<
9191
>
9292
{children}
9393
<SheetPrimitive.Close className="flex items-center gap-1 rounded-sm p-1 pl-0 transition hover:bg-charcoal-750 focus-visible:focus-custom disabled:pointer-events-none">
94-
<ShortcutKey shortcut={{ key: "esc" }} variant="small" />
94+
<ShortcutKey
95+
shortcut={{
96+
windows: {
97+
key: "esc",
98+
},
99+
mac: {
100+
key: "esc",
101+
},
102+
}}
103+
variant="small"
104+
/>
95105
<XMarkIcon className="size-4 text-text-dimmed" />
96106
<span className="sr-only">Close</span>
97107
</SheetPrimitive.Close>

0 commit comments

Comments
 (0)