From 73fa9685957577052da00fe43a228770fe7f8b35 Mon Sep 17 00:00:00 2001 From: Alfred Louis Date: Thu, 5 Oct 2023 20:29:16 +0700 Subject: [PATCH] fix:Menus go back button style fix (#1860) * fix:Menus go back button style fix * adjust padding * use light icon button --- .../components/DropdownMenuHeader.tsx | 51 ++++++++----------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/front/src/modules/ui/dropdown/components/DropdownMenuHeader.tsx b/front/src/modules/ui/dropdown/components/DropdownMenuHeader.tsx index 9889a6982..66429d73d 100644 --- a/front/src/modules/ui/dropdown/components/DropdownMenuHeader.tsx +++ b/front/src/modules/ui/dropdown/components/DropdownMenuHeader.tsx @@ -1,7 +1,7 @@ -import { ComponentProps } from 'react'; -import { useTheme } from '@emotion/react'; +import { ComponentProps, MouseEvent } from 'react'; import styled from '@emotion/styled'; +import { LightIconButton } from '@/ui/button/components/LightIconButton'; import { IconComponent } from '@/ui/icon/types/IconComponent'; const StyledHeader = styled.li` @@ -11,31 +11,16 @@ const StyledHeader = styled.li` font-size: ${({ theme }) => theme.font.size.sm}; font-weight: ${({ theme }) => theme.font.weight.medium}; - padding: ${({ theme }) => theme.spacing(2)}; + padding: ${({ theme }) => theme.spacing(1)}; user-select: none; - - ${({ onClick, theme }) => { - if (onClick) { - return ` - cursor: pointer; - - &:hover { - background: ${theme.background.transparent.light}; - } - `; - } - }} `; -const StyledStartIconWrapper = styled.span` - color: ${({ theme }) => theme.font.color.tertiary}; - display: inline-flex; - margin-right: ${({ theme }) => theme.spacing(2)}; +const StyledChildrenWrapper = styled.span` + padding: 0 ${({ theme }) => theme.spacing(1)}; `; -const StyledEndIconWrapper = styled(StyledStartIconWrapper)` - color: ${({ theme }) => theme.font.color.tertiary}; +const StyledLightIconButton = styled(LightIconButton)` display: inline-flex; margin-left: auto; margin-right: 0; @@ -44,29 +29,35 @@ const StyledEndIconWrapper = styled(StyledStartIconWrapper)` type DropdownMenuHeaderProps = ComponentProps<'li'> & { StartIcon?: IconComponent; EndIcon?: IconComponent; + onClick?: (event: MouseEvent) => void; }; export const DropdownMenuHeader = ({ children, StartIcon, EndIcon, + onClick, ...props }: DropdownMenuHeaderProps) => { - const theme = useTheme(); - return ( // eslint-disable-next-line twenty/no-spread-props {StartIcon && ( - - - + )} - {children} + {children} {EndIcon && ( - - - + )} );