-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Artur Santiago
committed
Oct 14, 2021
1 parent
104d445
commit 8779c4f
Showing
1 changed file
with
68 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,69 @@ | ||
import React from 'react'; | ||
import { ListItem, ListItemIcon, ListItemText } from '@material-ui/core'; | ||
import { SvgIconComponent } from '@material-ui/icons'; | ||
import { makeStyles } from '@material-ui/styles'; | ||
import clsx from 'clsx'; | ||
|
||
export const MenuItem = (): JSX.Element => ( | ||
<div> | ||
MenuItem | ||
</div> | ||
); | ||
const useStyles = makeStyles({ | ||
menuItem: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
minHeight: 44, | ||
}, | ||
menuItemActive: { | ||
backgroundColor: '#EBEBEC', | ||
}, | ||
icon: { | ||
justifyContent: 'center', | ||
}, | ||
iconActive: { | ||
color: '#6EC177', | ||
}, | ||
primaryText: { | ||
whiteSpace: 'nowrap', | ||
}, | ||
primaryTextActive: { | ||
color: '#6EC177', | ||
fontWeight: 500, | ||
}, | ||
}); | ||
|
||
type Props = { | ||
icon: SvgIconComponent | ||
small?: boolean | ||
path: string | ||
primaryText: string | ||
onClick: () => void | ||
} | ||
|
||
export const MenuItem = ({ | ||
icon: Icon, | ||
small, | ||
path, | ||
primaryText, | ||
onClick, | ||
}: Props): JSX.Element => { | ||
const classes = useStyles(); | ||
const isActive = path === '/dashboard'; | ||
|
||
function handleOnClick() { | ||
onClick?.(); | ||
} | ||
|
||
return ( | ||
<ListItem | ||
button | ||
className={clsx(classes.menuItem, isActive && classes.menuItemActive)} | ||
onClick={handleOnClick} | ||
> | ||
<ListItemIcon className={clsx(classes.icon, isActive && classes.iconActive)}> | ||
<Icon /> | ||
</ListItemIcon> | ||
{/* {!small && ( */} | ||
<ListItemText | ||
primary={!small && primaryText} | ||
primaryTypographyProps={{ variant: 'body2', className: clsx(classes.primaryText, isActive && classes.primaryTextActive) }} | ||
/> | ||
{/* )} */} | ||
</ListItem> | ||
); | ||
}; |