Skip to content

Commit 7f71441

Browse files
committed
Allow dark menu on light mode
1 parent b295f67 commit 7f71441

5 files changed

Lines changed: 36 additions & 5 deletions

File tree

src/checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function getCheckboxStyle({
160160
const style = {
161161
checkbox: [],
162162
card: [
163-
'flex-1 rounded-lg px-4 py-3 items-start',
163+
'text-wrap text-balance flex-1 rounded-lg px-4 py-3 items-start',
164164
'[&>[data-check-indicator]:not([class*=mt-])]:mt-1',
165165
'[&_[data-ui=icon]:not([class*=size-])]:w-4 [&_[data-ui=icon]:not([class*=size-])]:h-[1lh]',
166166
'ring ring-border',

src/menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ export function MenuItem({ destructive, ...props }: MenuItemProps) {
197197
props.className,
198198
(className, { isFocused, isDisabled }) => {
199199
return twMerge([
200-
'group rounded-sm outline-hidden',
200+
'group rounded-sm outline-hidden text-(--foreground)',
201201
'flex items-center gap-x-1.5',
202202
'px-2 py-2.5 sm:py-1.5',
203203
'text-base/6 sm:text-sm/6',

stories/Menu.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ Menu buttons are <a href="./?path=/docs/button--docs" target="_blank">**Buttons*
1616

1717
<Canvas of={MenuStories.MenuButtons} />
1818

19+
## Dark dropdown on light mode
20+
21+
You can add `dark` class to the `MenuPopover` component to render a dark dropdown in light mode.
22+
23+
<Canvas of={MenuStories.DarkDropdownOnLightMode} />
24+
1925
## Disabled state
2026

2127
<Canvas of={MenuStories.DisabledState} />

stories/Menu.stories.tsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const BasicExample = () => {
6767
return (
6868
<MenuTrigger>
6969
<MenuButton>Actions</MenuButton>
70-
<MenuPopover>
70+
<MenuPopover className="">
7171
<Menu>
7272
<MenuItem>Copy</MenuItem>
7373
<MenuItem>Cut</MenuItem>
@@ -95,6 +95,22 @@ export const MenuButtons = () => {
9595
);
9696
};
9797

98+
export const DarkDropdownOnLightMode = () => {
99+
return (
100+
<MenuTrigger>
101+
<MenuButton>Actions</MenuButton>
102+
<MenuPopover className="dark">
103+
<Menu>
104+
<MenuItem>Copy</MenuItem>
105+
<MenuItem>Cut</MenuItem>
106+
<MenuItem>Paste</MenuItem>
107+
<MenuItem>Delete</MenuItem>
108+
</Menu>
109+
</MenuPopover>
110+
</MenuTrigger>
111+
);
112+
};
113+
98114
export const DisabledState = () => {
99115
return (
100116
<MenuTrigger>
@@ -349,7 +365,7 @@ export const ItemWithIconShortcutHintsAndDescriptions = () => {
349365
return (
350366
<MenuTrigger>
351367
<MenuButton>Actions</MenuButton>
352-
<MenuPopover>
368+
<MenuPopover className="dark">
353369
<Menu>
354370
<MenuItem>
355371
<Icon>

stories/RadioGroup.stories.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,20 +503,29 @@ export function RadioCards() {
503503
{
504504
name: 'Pick up your order at your local store',
505505
description: '2-5 business days',
506+
default: true,
506507
},
507508
{
508509
name: 'Delivery to GLS collection store',
509510
description: 'Arrives before Monday, Nov 6',
511+
default: false,
510512
},
511513
{
512514
name: 'GLS delivery to selected address',
513515
description: 'Arrives before Monday, Nov 6',
516+
default: false,
514517
},
515518
].map((option) => {
516519
return (
517520
<Radio key={option.name} value={option.name}>
518521
<div className="flex flex-1 flex-col">
519-
<div className="flex font-medium">{option.name}</div>
522+
<div className="flex font-medium">
523+
{option.name}
524+
525+
{option.default && (
526+
<Badge className="ms-auto">Default</Badge>
527+
)}
528+
</div>
520529
<div className="text-gray-500">{option.description}</div>
521530
</div>
522531
</Radio>

0 commit comments

Comments
 (0)