frontend/containers/ClearButton/index.tsx (view raw)
1import IconButton from '@mui/material/IconButton';
2import Icon from '@mui/material/Icon';
3import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction';
4
5interface Props {
6 onClick?: () => void;
7 icon: string;
8 tabIndex?: number;
9}
10
11const ClearButton = (props: Props) => {
12 const {icon, onClick, tabIndex} = props;
13
14 if (onClick)
15 return (
16 <ListItemSecondaryAction>
17 <IconButton size="small" color="primary" onClick={onClick} tabIndex={tabIndex}>
18 <Icon>{icon}</Icon>
19 </IconButton>
20 </ListItemSecondaryAction>
21 );
22
23 return <Icon color="primary">{icon}</Icon>;
24};
25
26export default ClearButton;