Change to Material-UI switch for settings
parent
09ebb8f0d9
commit
ac079d1cd1
|
|
@ -4,13 +4,14 @@ import { withStyles } from '@material-ui/core/styles';
|
||||||
import { withRoomContext } from '../../RoomContext';
|
import { withRoomContext } from '../../RoomContext';
|
||||||
import * as settingsActions from '../../actions/settingsActions';
|
import * as settingsActions from '../../actions/settingsActions';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import classnames from 'classnames';
|
||||||
import { useIntl, FormattedMessage } from 'react-intl';
|
import { useIntl, FormattedMessage } from 'react-intl';
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
import FormHelperText from '@material-ui/core/FormHelperText';
|
import FormHelperText from '@material-ui/core/FormHelperText';
|
||||||
import FormControl from '@material-ui/core/FormControl';
|
import FormControl from '@material-ui/core/FormControl';
|
||||||
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
||||||
import Select from '@material-ui/core/Select';
|
import Select from '@material-ui/core/Select';
|
||||||
import Checkbox from '@material-ui/core/Checkbox';
|
import Switch from '@material-ui/core/Switch';
|
||||||
|
|
||||||
const styles = (theme) =>
|
const styles = (theme) =>
|
||||||
({
|
({
|
||||||
|
|
@ -21,6 +22,13 @@ const styles = (theme) =>
|
||||||
formControl :
|
formControl :
|
||||||
{
|
{
|
||||||
display : 'flex'
|
display : 'flex'
|
||||||
|
},
|
||||||
|
switchLabel : {
|
||||||
|
justifyContent : 'space-between',
|
||||||
|
flex : 'auto',
|
||||||
|
display : 'flex',
|
||||||
|
padding : theme.spacing(1),
|
||||||
|
marginRight : 0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -37,16 +45,18 @@ const AdvancedSettings = ({
|
||||||
return (
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
className={classes.setting}
|
className={classnames(classes.setting, classes.switchLabel)}
|
||||||
control={<Checkbox checked={settings.advancedMode} onChange={onToggleAdvancedMode} value='advancedMode' />}
|
control={<Switch checked={settings.advancedMode} onChange={onToggleAdvancedMode} value='advancedMode' />}
|
||||||
|
labelPlacement='start'
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id : 'settings.advancedMode',
|
id : 'settings.advancedMode',
|
||||||
defaultMessage : 'Advanced mode'
|
defaultMessage : 'Advanced mode'
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
className={classes.setting}
|
className={classnames(classes.setting, classes.switchLabel)}
|
||||||
control={<Checkbox checked={settings.notificationSounds} onChange={onToggleNotificationSounds} value='notificationSounds' />}
|
control={<Switch checked={settings.notificationSounds} onChange={onToggleNotificationSounds} value='notificationSounds' />}
|
||||||
|
labelPlacement='start'
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id : 'settings.notificationSounds',
|
id : 'settings.notificationSounds',
|
||||||
defaultMessage : 'Notification sounds'
|
defaultMessage : 'Notification sounds'
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import * as appPropTypes from '../appPropTypes';
|
||||||
import { withStyles } from '@material-ui/core/styles';
|
import { withStyles } from '@material-ui/core/styles';
|
||||||
import * as roomActions from '../../actions/roomActions';
|
import * as roomActions from '../../actions/roomActions';
|
||||||
import * as settingsActions from '../../actions/settingsActions';
|
import * as settingsActions from '../../actions/settingsActions';
|
||||||
|
import classnames from 'classnames';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { useIntl, FormattedMessage } from 'react-intl';
|
import { useIntl, FormattedMessage } from 'react-intl';
|
||||||
import MenuItem from '@material-ui/core/MenuItem';
|
import MenuItem from '@material-ui/core/MenuItem';
|
||||||
|
|
@ -11,7 +12,7 @@ import FormHelperText from '@material-ui/core/FormHelperText';
|
||||||
import FormControl from '@material-ui/core/FormControl';
|
import FormControl from '@material-ui/core/FormControl';
|
||||||
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
||||||
import Select from '@material-ui/core/Select';
|
import Select from '@material-ui/core/Select';
|
||||||
import Checkbox from '@material-ui/core/Checkbox';
|
import Switch from '@material-ui/core/Switch';
|
||||||
|
|
||||||
const styles = (theme) =>
|
const styles = (theme) =>
|
||||||
({
|
({
|
||||||
|
|
@ -22,6 +23,13 @@ const styles = (theme) =>
|
||||||
formControl :
|
formControl :
|
||||||
{
|
{
|
||||||
display : 'flex'
|
display : 'flex'
|
||||||
|
},
|
||||||
|
switchLabel : {
|
||||||
|
justifyContent : 'space-between',
|
||||||
|
flex : 'auto',
|
||||||
|
display : 'flex',
|
||||||
|
padding : theme.spacing(1),
|
||||||
|
marginRight : 0
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -90,24 +98,28 @@ const AppearenceSettings = ({
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</form>
|
</form>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
className={classes.setting}
|
className={classnames(classes.setting, classes.switchLabel)}
|
||||||
control={<Checkbox checked={settings.permanentTopBar} onChange={onTogglePermanentTopBar} value='permanentTopBar' />}
|
control={
|
||||||
|
<Switch checked={settings.permanentTopBar} onChange={onTogglePermanentTopBar} value='permanentTopBar' />}
|
||||||
|
labelPlacement='start'
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id : 'settings.permanentTopBar',
|
id : 'settings.permanentTopBar',
|
||||||
defaultMessage : 'Permanent top bar'
|
defaultMessage : 'Permanent top bar'
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
className={classes.setting}
|
className={classnames(classes.setting, classes.switchLabel)}
|
||||||
control={<Checkbox checked={settings.hiddenControls} onChange={onToggleHiddenControls} value='hiddenControls' />}
|
control={<Switch checked={settings.hiddenControls} onChange={onToggleHiddenControls} value='hiddenControls' />}
|
||||||
|
labelPlacement='start'
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id : 'settings.hiddenControls',
|
id : 'settings.hiddenControls',
|
||||||
defaultMessage : 'Hidden media controls'
|
defaultMessage : 'Hidden media controls'
|
||||||
})}
|
})}
|
||||||
/>
|
/>
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
className={classes.setting}
|
className={classnames(classes.setting, classes.switchLabel)}
|
||||||
control={<Checkbox checked={settings.buttonControlBar} onChange={onToggleButtonControlBar} value='buttonControlBar' />}
|
control={<Switch checked={settings.buttonControlBar} onChange={onToggleButtonControlBar} value='buttonControlBar' />}
|
||||||
|
labelPlacement='start'
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id : 'settings.buttonControlBar',
|
id : 'settings.buttonControlBar',
|
||||||
defaultMessage : 'Separate media controls'
|
defaultMessage : 'Separate media controls'
|
||||||
|
|
@ -115,8 +127,9 @@ const AppearenceSettings = ({
|
||||||
/>
|
/>
|
||||||
{ !isMobile &&
|
{ !isMobile &&
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
className={classes.setting}
|
className={classnames(classes.setting, classes.switchLabel)}
|
||||||
control={<Checkbox checked={settings.drawerOverlayed} onChange={onToggleDrawerOverlayed} value='drawerOverlayed' />}
|
control={<Switch checked={settings.drawerOverlayed} onChange={onToggleDrawerOverlayed} value='drawerOverlayed' />}
|
||||||
|
labelPlacement='start'
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id : 'settings.drawerOverlayed',
|
id : 'settings.drawerOverlayed',
|
||||||
defaultMessage : 'Side drawer over content'
|
defaultMessage : 'Side drawer over content'
|
||||||
|
|
@ -124,8 +137,9 @@ const AppearenceSettings = ({
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<FormControlLabel
|
<FormControlLabel
|
||||||
className={classes.setting}
|
className={classnames(classes.setting, classes.switchLabel)}
|
||||||
control={<Checkbox checked={settings.showNotifications} onChange={onToggleShowNotifications} value='showNotifications' />}
|
control={<Switch checked={settings.showNotifications} onChange={onToggleShowNotifications} value='showNotifications' />}
|
||||||
|
labelPlacement='start'
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
id : 'settings.showNotifications',
|
id : 'settings.showNotifications',
|
||||||
defaultMessage : 'Show notifications'
|
defaultMessage : 'Show notifications'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue