all repos — caroster @ be8f93ea0966f0bc0587c2c127ee1ba15594a049

[Octree] Group carpool to your event https://caroster.io

frontend/containers/ClearButton/index.tsx (view raw)

 1import IconButton from '@material-ui/core/IconButton';
 2import Icon from '@material-ui/core/Icon';
 3import ListItemSecondaryAction from '@material-ui/core/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;