Rename SettingsCheckbox to be a bit more generic

Splitting out the logic to two components doesn't make sense, but this isn't always a checkbox.

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-10-30 20:08:27 -06:00
parent 3efb0fdeeb
commit f070604350
3 changed files with 10 additions and 10 deletions

View file

@ -664,10 +664,10 @@ module.exports = React.createClass({
},
_renderSyncedSetting: function(setting) {
const SettingsCheckbox = sdk.getComponent("elements.SettingsCheckbox");
const SettingsFlag = sdk.getComponent("elements.SettingsFlag");
return (
<div className="mx_UserSettings_toggle" key={setting.id}>
<SettingsCheckbox name={setting.id}
<SettingsFlag name={setting.id}
label={setting.label}
level="account"
onChange={setting.fn} />
@ -676,11 +676,11 @@ module.exports = React.createClass({
},
_renderThemeSelector: function(setting) {
const SettingsCheckbox = sdk.getComponent("elements.SettingsCheckbox");
const SettingsFlag = sdk.getComponent("elements.SettingsFlag");
const onChange = (v) => dis.dispatch({action: 'set_theme', value: setting.value});
return (
<div className="mx_UserSettings_toggle" key={setting.id + '_' + setting.value}>
<SettingsCheckbox name="theme"
<SettingsFlag name="theme"
label={setting.label}
level="account"
onChange={onChange}
@ -756,10 +756,10 @@ module.exports = React.createClass({
},
_renderLocalSetting: function(setting) {
const SettingsCheckbox = sdk.getComponent("elements.SettingsCheckbox");
const SettingsFlag = sdk.getComponent("elements.SettingsFlag");
return (
<div className="mx_UserSettings_toggle" key={setting.id}>
<SettingsCheckbox name={setting.id}
<SettingsFlag name={setting.id}
label={setting.label}
level="device"
onChange={setting.fn} />

View file

@ -19,7 +19,7 @@ import SettingsStore from "../../../settings/SettingsStore";
import { _t } from '../../../languageHandler';
module.exports = React.createClass({
displayName: 'SettingsCheckbox',
displayName: 'SettingsFlag',
propTypes: {
name: React.PropTypes.string.isRequired,
level: React.PropTypes.string.isRequired,

View file

@ -34,7 +34,7 @@ module.exports = React.createClass({
},
render: function() {
const SettingsCheckbox = sdk.getComponent("elements.SettingsCheckbox");
const SettingsFlag = sdk.getComponent("elements.SettingsFlag");
const roomId = this.props.room.roomId;
let previewsForAccount = null;
@ -53,7 +53,7 @@ module.exports = React.createClass({
if (SettingsStore.canSetValue("urlPreviewsEnabled", roomId, "room")) {
previewsForRoom = (
<label>
<SettingsCheckbox name="urlPreviewsEnabled"
<SettingsFlag name="urlPreviewsEnabled"
level="room"
roomId={this.props.room.roomId}
isExplicit={true} />
@ -68,7 +68,7 @@ module.exports = React.createClass({
}
let previewsForRoomAccount = (
<SettingsCheckbox name="urlPreviewsEnabled"
<SettingsFlag name="urlPreviewsEnabled"
level="room-account"
roomId={this.props.room.roomId}
/>