import { Box, styled } from '@mui/material' import type { Theme } from '@mui/material' import type { ProductMenuLinkProps } from '../layout' import type { To } from 'react-router-dom' const ProductMenuContainer = styled('div')(({ theme, ...rest }) => { const t = theme as Theme const isActive = rest.className === 'active' const contentBackgroundColor = t.palette.mode === 'dark' ? t.palette.yacolor.bg.dark : t.palette.grey[100] return { width: '100%', cursor: 'pointer', padding: '.4rem .6rem', borderRadius: '6px', boxSizing: 'border-box', backgroundColor: isActive ? contentBackgroundColor : 'unset', '&:hover': { backgroundColor: contentBackgroundColor, '& .desc': { opacity: 1, transform: 'translateY(0px)', }, }, '& svg': { width: '14px', height: '14px', }, '& .name': { display: 'flex', flexWrap: 'nowrap', color: isActive && t.palette.primary.main, '& > .label': { display: 'block', fontSize: '14px', fontWeight: 'bold', }, }, '& .desc': { opacity: isActive ? 1 : 0, display: 'block', margin: 0, color: t.palette.grey[700], fontSize: '.6rem', }, } }) const ProductMenuLink: React.FC = (props) => { const { icon, name, description, path, isActive, onClick } = props return ( onClick(path as To)} className={isActive ? `active` : ''}>
{icon && ( theme.palette.mode === 'dark' ? theme.palette.primary[700] : theme.palette.grey[100], }, }} > {icon} )} {name}

{description}

) } export default ProductMenuLink