Skip to content

Commit 2aa4f2e

Browse files
authored
Update DropdownMenu styling (#3787)
1 parent 6d56df7 commit 2aa4f2e

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

.changeset/early-cobras-raise.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"gitbook": patch
3+
---
4+
5+
Update dropdown menu styling

packages/gitbook/src/components/primitives/DropdownMenu.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ const DropdownMenuContext = createContext<{
2424
setOpen: () => {},
2525
});
2626

27+
const DROPDOWN_CONTENT_OUTER_CLASS =
28+
'z-50 flex max-h-(--radix-dropdown-menu-content-available-height) min-w-28 xs:min-w-40 max-w-(--radix-dropdown-menu-content-available-width) origin-top animate-scale-in flex-col pt-2 data-[state=closed]:animate-scale-out';
29+
const DROPDOWN_CONTENT_INNER_CLASS =
30+
'flex flex-col gap-1 overflow-auto circular-corners:rounded-xl rounded-md straight-corners:rounded-none border border-tint bg-tint-base p-2 shadow-lg';
31+
2732
/**
2833
* Button with a dropdown.
2934
*/
@@ -82,14 +87,9 @@ export function DropdownMenu(props: {
8287
onMouseLeave={() => setHovered(false)}
8388
align={align}
8489
side={side}
85-
className="z-50 animate-scale-in border-tint pt-2"
90+
className={DROPDOWN_CONTENT_OUTER_CLASS}
8691
>
87-
<div
88-
className={tcls(
89-
'flex max-h-[30rem] min-w-40 max-w-[40vw] flex-col gap-1 overflow-auto circular-corners:rounded-xl rounded-md straight-corners:rounded-none border border-tint bg-tint-base p-2 shadow-lg sm:min-w-52 sm:max-w-80',
90-
className
91-
)}
92-
>
92+
<div className={tcls(DROPDOWN_CONTENT_INNER_CLASS, className)}>
9393
{children}
9494
</div>
9595
</RadixDropdownMenu.Content>
@@ -162,7 +162,7 @@ export function DropdownMenuItem(
162162
} = props;
163163

164164
const itemClassName = tcls(
165-
'rounded-xs straight-corners:rounded-xs circular-corners:rounded-lg px-3 py-1 text-sm flex gap-2 items-center',
165+
'rounded-sm straight-corners:rounded-none circular-corners:rounded-lg px-3 py-1 text-sm flex gap-2 items-center',
166166
active
167167
? 'bg-primary text-primary-strong data-highlighted:bg-primary-hover'
168168
: 'data-highlighted:bg-tint-hover',
@@ -214,11 +214,9 @@ export function DropdownSubMenu(props: { children: React.ReactNode; label: React
214214
<RadixDropdownMenu.SubContent
215215
hideWhenDetached
216216
collisionPadding={8}
217-
className="z-50 animate-present"
217+
className={DROPDOWN_CONTENT_OUTER_CLASS}
218218
>
219-
<div className="flex max-h-96 min-w-40 max-w-[40vw] flex-col gap-1 overflow-auto rounded-lg straight-corners:rounded-sm bg-tint-base p-2 shadow-lg ring-1 ring-tint-subtle sm:min-w-52 sm:max-w-80">
220-
{children}
221-
</div>
219+
<div className={DROPDOWN_CONTENT_INNER_CLASS}>{children}</div>
222220
</RadixDropdownMenu.SubContent>
223221
</RadixDropdownMenu.Portal>
224222
</RadixDropdownMenu.Sub>

0 commit comments

Comments
 (0)