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 console.log(props.disabled)
18
19 return (
20 <ListItemSecondaryAction className={classes.action} onClick={onClick} tabIndex={tabIndex}>
21 <IconButton className={classes.button} disabled={props.disabled}>
22 {t('passenger.actions.place')}
23 <Icon>chevron_right</Icon>
24 </IconButton>
25 </ListItemSecondaryAction>
26 );
27};
28
29const useStyles = makeStyles(theme => ({
30 action: {
31 top: theme.spacing(3),
32 },
33 button: ({disabled}) => ({
34 borderRadius: theme.spacing(1),
35 margin: theme.spacing(1, 0, 0, 0),
36 padding: 0,
37 fontSize: '1rem',
38 lineHeight: 1.5,
39 color: disabled ? 'black' : theme.palette.primary.main
40 }),
41}));
42
43export default AssignButton;