diff --git a/src/modules/Header/HeaderMenuButton.tsx b/src/modules/Header/HeaderMenuButton.tsx index 5d7ecf2..18e89e5 100644 --- a/src/modules/Header/HeaderMenuButton.tsx +++ b/src/modules/Header/HeaderMenuButton.tsx @@ -1,45 +1,49 @@ import { Icon, MenuButton, forwardRef, useMenuContext } from "@chakra-ui/react"; -import { XIcon, type LucideIcon } from "lucide-react"; +import { type LucideIcon, XIcon } from "lucide-react"; export type HeaderMenuButtonProps = { icon: LucideIcon; + closeIcon?: LucideIcon; }; const OPEN_MARGIN_IN_PIXEL = 4; const BORDER_WIDTH_IN_PIXEL = 2; const MAX_CONTAINER_SIZE_IN_PIXEL = 56; -export const HeaderMenuButton = forwardRef(({ icon, as, ...props }, ref) => { - const { isOpen } = useMenuContext(); +export const HeaderMenuButton = forwardRef( + (props, ref) => { + const { as, icon, closeIcon = XIcon } = props; + const { isOpen } = useMenuContext(); - const containerSize = isOpen - ? MAX_CONTAINER_SIZE_IN_PIXEL - - OPEN_MARGIN_IN_PIXEL * 2 - - BORDER_WIDTH_IN_PIXEL - : MAX_CONTAINER_SIZE_IN_PIXEL - BORDER_WIDTH_IN_PIXEL; + const containerSize = isOpen + ? MAX_CONTAINER_SIZE_IN_PIXEL - + OPEN_MARGIN_IN_PIXEL * 2 - + BORDER_WIDTH_IN_PIXEL + : MAX_CONTAINER_SIZE_IN_PIXEL - BORDER_WIDTH_IN_PIXEL; - return ( - - - - ); -}) + return ( + + + + ); + }, +);