ente/src/components/OverflowMenu/option.tsx

38 lines
985 B
TypeScript
Raw Normal View History

2022-06-21 09:04:24 +00:00
import { MenuItem, ListItemIcon, ButtonProps, Typography } from '@mui/material';
2022-06-21 08:22:31 +00:00
import React from 'react';
interface Iprops {
2022-06-21 09:04:24 +00:00
onClick: () => void;
color?: ButtonProps['color'];
startIcon?: React.ReactNode;
label: any;
2022-06-21 08:22:31 +00:00
}
export function OverflowMenuOption({
2022-06-21 09:04:24 +00:00
onClick,
color = 'primary',
2022-06-21 08:22:31 +00:00
startIcon,
label,
}: Iprops) {
return (
<MenuItem
2022-06-21 09:04:24 +00:00
onClick={onClick}
2022-06-21 08:22:31 +00:00
sx={{
color: (theme) => theme.palette[color].main,
padding: '12px',
}}>
2022-06-21 09:04:24 +00:00
{startIcon && (
<ListItemIcon
sx={{
color: 'inherit',
padding: '0',
paddingRight: '12px',
fontSize: '20px',
}}>
{startIcon}
</ListItemIcon>
)}
<Typography variant="button">{label}</Typography>
2022-06-21 08:22:31 +00:00
</MenuItem>
);
}