Skip to content

Commit

Permalink
Laura's notes
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-cedrone-cengage committed Oct 6, 2023
1 parent d8970d8 commit 4fc3b4e
Showing 1 changed file with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@ import { ThemeContext } from '../../theme/ThemeContext';
import { DropdownContext } from './Dropdown';
import { Omit, useForkedRef } from '../../utils';
import { DropdownExpandableMenuGroupContext } from './DropdownExpandableMenuGroup';
import {
DropdownMenuItem,
DropdownMenuItemProps,
menuBackground,
} from './DropdownMenuItem';
import { DropdownMenuItem, DropdownMenuItemProps } from './DropdownMenuItem';

export interface DropdownExpandableMenuListItemProps
extends Omit<DropdownMenuItemProps, 'icon'> {}
extends Omit<DropdownMenuItemProps, 'icon'> {
testId?: string;
}

function menuItemPadding(props) {
//For DropdownExpandableMenu styling with an icon
if (props.expandableMenuButtonHasIcon && props.isExpandablePanel) {
return `${props.theme.spaceScale.spacing03} ${props.theme.spaceScale.spacing05} ${props.theme.spaceScale.spacing03} 72px`;
}
//For DropdownExpandableMenu styling without an icon
else if (props.isExpandablePanel) {
if (props.isExpandablePanel) {
if (props.expandableMenuButtonHasIcon) {
return `${props.theme.spaceScale.spacing03} ${props.theme.spaceScale.spacing05} ${props.theme.spaceScale.spacing03} 72px`;
}
return `${props.theme.spaceScale.spacing03} ${props.theme.spaceScale.spacing05} ${props.theme.spaceScale.spacing03} ${props.theme.spaceScale.spacing08}`;
}
}
Expand All @@ -32,10 +28,6 @@ const StyledDropdownMenuItem = styled(DropdownMenuItem)<{
isInverse?: boolean;
}>`
padding: ${menuItemPadding};
&:hover,
&:focus {
background: ${menuBackground};
}
`;

export const DropdownExpandableMenuListItem = React.forwardRef<
Expand All @@ -62,10 +54,7 @@ export const DropdownExpandableMenuListItem = React.forwardRef<
{...other}
expandableMenuButtonHasIcon={menuGroupContext.expandableMenuButtonHasIcon}
isExpandablePanel={menuGroupContext.isExpandablePanel}
isFixedWidth={context.isFixedWidth}
isInverse={context.isInverse}
ref={disabled ? null : ref}
role="menuitem"
theme={theme}
>
{children}
Expand Down

0 comments on commit 4fc3b4e

Please sign in to comment.