Skip to content

Commit

Permalink
fix: menu trigger updated to accomodate children
Browse files Browse the repository at this point in the history
  • Loading branch information
madhurisandbhor committed Jul 18, 2024
1 parent f16575e commit df1472e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/stories/SimpleMenu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ import { Menu } from '@strapi/design-system';
const MyMenu = () => {
return (
<Menu.Root>
<Menu.Trigger label="Actions" />
<Menu.Trigger>Actions</Menu.Trigger>
<Menu.Content>
<Menu.Item onSelect={() => console.log('opening')}>Open</MenuItem>
<Menu.Item disabled onSelect={() => console.log('cloning')}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface ComponentProps {

const Component = ({ onAction1Select, onSubmenuAction1Select }: ComponentProps) => (
<Menu.Root>
<Menu.Trigger label="Actions" />
<Menu.Trigger>Actions</Menu.Trigger>
<Menu.Content>
<Menu.Item onSelect={onAction1Select}>Action 1</Menu.Item>
<Menu.Item isLink href="/home">
Expand Down
6 changes: 2 additions & 4 deletions packages/design-system/src/components/SimpleMenu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MenuRoot = DropdownMenu.Root;
* MenuTrigger
* -----------------------------------------------------------------------------------------------*/

type TriggerPropsBase = Omit<ButtonProps, 'tag' | 'children'> & {
type TriggerPropsBase = Omit<ButtonProps, 'tag'> & {
endIcon?: React.ReactNode;
label?: React.ReactNode | string;
};
Expand Down Expand Up @@ -65,9 +65,7 @@ const MenuTrigger = React.forwardRef<HTMLButtonElement, TriggerProps>(
{icon}
</IconButton>
) : (
<Button endIcon={endIcon} {...props}>
{label}
</Button>
<Button endIcon={endIcon} {...props} />
)}
</DropdownMenu.Trigger>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ const SimpleMenu = React.forwardRef<HTMLButtonElement, SimpleMenuProps>(

return (
<Menu.Root onOpenChange={handleOpenChange}>
<Menu.Trigger ref={composedRef} {...props} />
<Menu.Trigger ref={composedRef} {...props}>
{props.label}
</Menu.Trigger>
<Menu.Content ref={contentRef} intersectionId={intersectionId} popoverPlacement={popoverPlacement}>
{children}
</Menu.Content>
Expand Down

0 comments on commit df1472e

Please sign in to comment.