Skip to content

Commit eeb69aa

Browse files
committed
fix more styles
1 parent 9834469 commit eeb69aa

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/components/Menu.stories.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import { Info } from './svgs/Info';
44

55
export const Default = () =>
66
<>
7+
<Menu buttonLabel="Menu">
8+
<button>Example button</button>
9+
<button>Another button</button>
10+
</Menu>
711
<Menu buttonLabel="Test menu" buttonIcon={Info}>
812
<button>Example button</button>
913
<button>Another button</button>

src/components/Menu.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ import { Button, ButtonProps, Dialog, DialogTrigger, Popover, PopoverProps } fro
55
export const MenuButton = styled(Button)`
66
border: none;
77
background: none;
8+
padding: 0;
9+
min-height: 4.2rem;
10+
min-width: 4.2rem;
11+
display: inline-flex;
12+
place-content: center;
13+
align-items: center;
814
`;
915

1016
export const MenuPopover = styled(Popover)`
@@ -16,7 +22,7 @@ export const MenuPopover = styled(Popover)`
1622

1723
export interface MenuProps {
1824
buttonLabel: string;
19-
buttonIcon: string | React.ReactNode;
25+
buttonIcon?: string | React.ReactNode;
2026
buttonProps?: ButtonProps;
2127
popoverProps?: PopoverProps;
2228
}
@@ -25,8 +31,8 @@ export const Menu = ({ buttonLabel, buttonIcon, ...props }: React.PropsWithChild
2531
return (
2632
<DialogTrigger>
2733
<MenuButton aria-label={buttonLabel} {...props.buttonProps}>
28-
{typeof buttonIcon === 'string' ?
29-
<img aria-hidden='true' src={buttonIcon} alt='' /> : buttonIcon}
34+
{buttonIcon ? (typeof buttonIcon === 'string' ?
35+
<img aria-hidden='true' src={buttonIcon} alt='' /> : buttonIcon) : buttonLabel}
3036
</MenuButton>
3137
<MenuPopover {...props.popoverProps}>
3238
<Dialog>

0 commit comments

Comments
 (0)