frontend/containers/WaitingList/AssignButton.tsx (view raw)
1import IconButton from '@material-ui/core/IconButton';
2import Icon from '@material-ui/core/Icon';
3import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction';
4import { makeStyles } from '@material-ui/core/styles';
5import {useTranslation} from 'react-i18next';
6
7interface Props {
8 onClick: () => void;
9 tabIndex?: number;
10 disabled: boolean
11}
12
13const AssignButton = (props: Props) => {
14 const {onClick, tabIndex} = props;
15 const classes = useStyles();
16 const {t} = useTranslation();
17
18 return (
19 <ListItemSecondaryAction className={classes.action} onClick={onClick} tabIndex={tabIndex}>
20 <IconButton className={classes.button} disabled={props.disabled}>
21 {t('passenger.actions.place')}
22 <Icon>chevron_right</Icon>
23 </IconButton>
24 </ListItemSecondaryAction>
25 );
26};
27
28const useStyles = makeStyles(theme => ({
29 action: {
30 top: theme.spacing(3),
31 },
32 button: ({disabled}) => ({
33 borderRadius: theme.spacing(1),
34 margin: theme.spacing(1, 0, 0, 0),
35 padding: 0,
36 fontSize: '1rem',
37 lineHeight: 1.5,
38 color: disabled ? 'black' : theme.palette.primary.main
39 }),
40}));
41
42export default AssignButton;