diff --git a/src/components/SideMenu/SideMenu.stories.tsx b/src/components/SideMenu/SideMenu.stories.tsx index f68bb46b..409a3cd8 100644 --- a/src/components/SideMenu/SideMenu.stories.tsx +++ b/src/components/SideMenu/SideMenu.stories.tsx @@ -73,5 +73,11 @@ let items = [ ]; export const _SideMenu = { - render: () => , + render: () => ( + alert('logo clicked')} + /> + ), }; diff --git a/src/components/SideMenu/SideMenu.tsx b/src/components/SideMenu/SideMenu.tsx index 4ce46c54..32e830e8 100644 --- a/src/components/SideMenu/SideMenu.tsx +++ b/src/components/SideMenu/SideMenu.tsx @@ -21,6 +21,7 @@ interface ISideMenuConfProps extends ComponentPropsWithoutRef<'div'> { interface ISideMenuProps extends ComponentPropsWithoutRef<'div'> { items?: ISideMenuItemProps[]; conf: ISideMenuConfProps; + onClickLogo?: () => void; } interface IShortItemProps extends ComponentPropsWithoutRef<'div'> { @@ -76,12 +77,17 @@ export function LongItem(props: ILongItemProps) { } function ShortMenu(props: ISideMenuProps) { - const { items, conf } = props; + const { items, conf, onClickLogo } = props; const { logo } = conf; return (
-
{logo}
+
+ {logo} +
{items ?.filter((item) => !item.footer) @@ -101,12 +107,15 @@ function ShortMenu(props: ISideMenuProps) { } function LongMenu(props: ISideMenuProps) { - const { items, conf } = props; + const { items, conf, onClickLogo } = props; const { logo, title } = conf; return (
-
+
{logo} {title} @@ -133,7 +142,7 @@ function LongMenu(props: ISideMenuProps) { } export function SideMenu(props: ISideMenuProps) { - const { items, conf } = props; + const { items, conf, onClickLogo } = props; const { fullMode } = conf; const [hover, setHover] = useState(true); @@ -141,7 +150,7 @@ export function SideMenu(props: ISideMenuProps) { const fullModeClass = fullMode ? 'fixed top-0 left-0 right-0' : ''; const hoverClass = hover ? 'w-20' : 'w-64'; - function handleOnMouseOver(e: any) { + function handleOnMouseOver(e: React.MouseEvent) { e.preventDefault(); setHover(!hover); } @@ -154,9 +163,9 @@ export function SideMenu(props: ISideMenuProps) { onMouseLeave={hover ? undefined : handleOnMouseOver} > {hover ? ( - + ) : ( - + )}
);