Skip to content

Commit

Permalink
refactor(Menu): replace with `Button
Browse files Browse the repository at this point in the history
  • Loading branch information
ze-flo committed May 9, 2024
1 parent 7b3082e commit 2527990
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
13 changes: 7 additions & 6 deletions packages/dropdowns/src/elements/menu/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ import { mergeRefs } from 'react-merge-refs';
import { ThemeContext } from 'styled-components';
import { useMenu } from '@zendeskgarden/container-menu';
import { DEFAULT_THEME, useWindow } from '@zendeskgarden/react-theming';
import { IButtonProps } from '@zendeskgarden/react-buttons';
import { Button, IButtonProps } from '@zendeskgarden/react-buttons';
import { IMenuProps, PLACEMENT } from '../../types';
import { MenuContext } from '../../context/useMenuContext';
import { toItems } from './utils';
import { MenuList } from './MenuList';
import { StyledButton } from '../../views';
import ChevronIcon from '@zendeskgarden/svg-icons/src/16/chevron-down-stroke.svg';

const BTN_COMPONENT_ID = 'dropdowns.menu.button';

/**
* @extends HTMLAttributes<HTMLUListElement>
*/
Expand Down Expand Up @@ -87,12 +88,12 @@ export const Menu = forwardRef<HTMLUListElement, IMenuProps>(
typeof button === 'function' ? (
button(triggerProps)
) : (
<StyledButton {...triggerProps}>
<Button {...triggerProps} data-garden-id={BTN_COMPONENT_ID}>
{button}
<StyledButton.EndIcon isRotated={isExpanded}>
<Button.EndIcon isRotated={isExpanded}>
<ChevronIcon />
</StyledButton.EndIcon>
</StyledButton>
</Button.EndIcon>
</Button>
);

const contextValue = useMemo(
Expand Down
1 change: 0 additions & 1 deletion packages/dropdowns/src/views/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,4 @@ export * from './menu/StyledItemGroup';
export * from './menu/StyledItemIcon';
export * from './menu/StyledItemMeta';
export * from './menu/StyledItemTypeIcon';
export * from './menu/StyledButton';
export * from './menu/StyledSeparator';
23 changes: 0 additions & 23 deletions packages/dropdowns/src/views/menu/StyledButton.ts

This file was deleted.

0 comments on commit 2527990

Please sign in to comment.