2021-12-28 14:35:21 +00:00
|
|
|
// @flow
|
|
|
|
import { makeStyles } from '@material-ui/core/styles';
|
|
|
|
import React from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
import { Switch } from '../../../base/react';
|
|
|
|
|
|
|
|
|
|
|
|
const useStyles = makeStyles(theme => {
|
|
|
|
return {
|
|
|
|
switchContainer: {
|
|
|
|
display: 'flex',
|
|
|
|
alignItems: 'center',
|
|
|
|
'& svg': {
|
|
|
|
display: 'none'
|
|
|
|
|
|
|
|
},
|
|
|
|
'& div': {
|
|
|
|
width: 38,
|
|
|
|
'& > label': {
|
|
|
|
width: 32,
|
|
|
|
height: 20,
|
|
|
|
backgroundColor: theme.palette.ui05,
|
|
|
|
'&:not([data-checked]):hover': {
|
|
|
|
backgroundColor: theme.palette.ui05
|
|
|
|
},
|
|
|
|
'&[data-checked]': {
|
|
|
|
backgroundColor: theme.palette.action01,
|
|
|
|
'&:hover': {
|
|
|
|
backgroundColor: theme.palette.action01
|
|
|
|
},
|
|
|
|
'&::before': {
|
|
|
|
margin: '0 0 1.5px -3px',
|
|
|
|
backgroundColor: theme.palette.text01
|
|
|
|
}
|
|
|
|
},
|
|
|
|
'&:focus-within': {
|
|
|
|
borderColor: 'transparent'
|
|
|
|
},
|
|
|
|
'&::before': {
|
|
|
|
width: 14,
|
|
|
|
height: 14,
|
|
|
|
margin: '0 0 1.5px 1.5px',
|
|
|
|
backgroundColor: theme.palette.text01
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
switchLabel: {
|
|
|
|
marginRight: 10,
|
|
|
|
...theme.typography.bodyShortRegular,
|
|
|
|
lineHeight: `${theme.typography.bodyShortRegular.lineHeight}px`
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
2022-04-06 09:10:31 +00:00
|
|
|
* The type of the React {@code Component} props of {@link ToggleFaceExpressionsButton}.
|
2021-12-28 14:35:21 +00:00
|
|
|
*/
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The function to initiate the change in the speaker stats table.
|
|
|
|
*/
|
|
|
|
onChange: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The state of the button.
|
|
|
|
*/
|
2022-04-06 09:10:31 +00:00
|
|
|
showFaceExpressions: boolean,
|
2021-12-28 14:35:21 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2022-04-06 09:10:31 +00:00
|
|
|
* React component for toggling face expressions grid.
|
2021-12-28 14:35:21 +00:00
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
2022-04-06 09:10:31 +00:00
|
|
|
export default function FaceExpressionsSwitch({ onChange, showFaceExpressions }: Props) {
|
2021-12-28 14:35:21 +00:00
|
|
|
const classes = useStyles();
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className = { classes.switchContainer } >
|
|
|
|
<label
|
|
|
|
className = { classes.switchLabel }
|
2022-04-06 09:10:31 +00:00
|
|
|
htmlFor = 'face-expressions-switch'>
|
2021-12-28 14:35:21 +00:00
|
|
|
{ t('speakerStats.displayEmotions')}
|
|
|
|
</label>
|
|
|
|
<Switch
|
2022-04-06 09:10:31 +00:00
|
|
|
id = 'face-expressions-switch'
|
2021-12-28 14:35:21 +00:00
|
|
|
onValueChange = { onChange }
|
|
|
|
trackColor = {{ false: 'blue' }}
|
2022-04-06 09:10:31 +00:00
|
|
|
value = { showFaceExpressions } />
|
2021-12-28 14:35:21 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|