Cosmetic refactoring on context menu (#1209)

* Cosmetic refactoring on context menu

* Fix lint

* Fix lint

* Fix lint

* Fix lint

* Fix lint

* Fix lint
This commit is contained in:
Charles Bochet
2023-08-15 02:34:23 +02:00
committed by GitHub
parent 444d9a9ca1
commit e3dc3b3e4a
30 changed files with 196 additions and 210 deletions

View File

@ -9,14 +9,17 @@ import { hoverBackground } from '@/ui/theme/constants/effects';
const styledIconButtonGroupClassName = 'dropdown-menu-item-actions';
const StyledItem = styled.li`
export type DropdownMenuItemAccent = 'regular' | 'danger';
const StyledItem = styled.li<{ accent: DropdownMenuItemAccent }>`
--horizontal-padding: ${({ theme }) => theme.spacing(1)};
--vertical-padding: ${({ theme }) => theme.spacing(2)};
align-items: center;
border-radius: ${({ theme }) => theme.border.radius.sm};
color: ${({ theme }) => theme.font.color.secondary};
color: ${({ theme, accent }) =>
accent === 'danger' ? theme.color.red : theme.font.color.secondary};
cursor: pointer;
display: flex;
@ -52,14 +55,16 @@ const StyledActions = styled(IconButtonGroup)`
export type DropdownMenuItemProps = ComponentProps<'li'> & {
actions?: IconButtonGroupProps['children'];
accent?: DropdownMenuItemAccent;
};
export const DropdownMenuItem = ({
actions,
children,
accent = 'regular',
...props
}: DropdownMenuItemProps) => (
<StyledItem {...props}>
<StyledItem {...props} accent={accent}>
{children}
{actions && (
<StyledActions