From e677ae440675a4167fe84aca2491c4e1d4c93e6a Mon Sep 17 00:00:00 2001 From: iqra-javed <35740252+iqra-javed@users.noreply.github.com> Date: Tue, 1 Jun 2021 09:39:14 -0500 Subject: [PATCH 01/12] fix: update default Menu styles --- src/Menu/Menu.stories.tsx | 15 +++++---- src/Menu/index.tsx | 69 +++++++++++++++++++++++++++------------ src/theme.ts | 17 ++++++++++ 3 files changed, 75 insertions(+), 26 deletions(-) diff --git a/src/Menu/Menu.stories.tsx b/src/Menu/Menu.stories.tsx index 4574dfe5..df522c5d 100644 --- a/src/Menu/Menu.stories.tsx +++ b/src/Menu/Menu.stories.tsx @@ -8,10 +8,10 @@ import { MenuItem, MenuLink, MenuDivider, + MenuIcon, } from '.'; -import { Icon } from '..'; import { filteredArgs } from '../utils'; -import { Flex } from '../layout'; +import { Flex, Box } from '../layout'; const meta: Meta = { title: 'Menu', @@ -38,10 +38,11 @@ const Template: Story = ({}) => { <> - Actions + Actions + - alert('Download')}>Download + Download alert('Copy')}>Create a Copy alert('Mark as Draft')}> Mark as Draft @@ -63,7 +64,8 @@ export const PositionedRight = () => ( - Actions + Actions + alert('Edit Profile')}>Edit Profile @@ -76,7 +78,8 @@ export const PositionedRight = () => ( export const DisabledItems = () => ( - Actions + Actions + alert('Edit Profile')}>Edit Profile diff --git a/src/Menu/index.tsx b/src/Menu/index.tsx index 40d82950..aa118fc7 100644 --- a/src/Menu/index.tsx +++ b/src/Menu/index.tsx @@ -9,11 +9,14 @@ import { MenuProps, MenuButtonProps, MenuItemsProps, + useMenuButtonContext, } from '@reach/menu-button'; import { positionDefault, positionRight } from '@reach/popover'; import styled from 'styled-components'; import Button, { ButtonProps } from '../Button'; import { Box, MinervaProps } from '../layout'; +import { useComponentStyles } from '../theme'; +import { ChevronDown } from '../Icon/baseIcons'; // import { useTheme } from '../theme'; // import '@reach/menu-button/styles.css'; @@ -26,9 +29,21 @@ export const MenuContainer = (props: MenuContainerProps) => ( ); -export const MenuButton = (props: MenuButtonProps & ButtonProps) => ( - -); +export const MenuButton = (props: MenuButtonProps & ButtonProps) => { + const componentStyles = useComponentStyles('MenuButton'); + const { isExpanded } = useMenuButtonContext(); + return ( + + ); +}; export interface MenuListProps extends MinervaProps { children?: React.ReactNode; @@ -37,15 +52,15 @@ export interface MenuListProps extends MinervaProps { export const OverlayBox = props => ( ); +export function MenuIcon() { + const { isExpanded } = useMenuButtonContext(); + + return ( +