From 6fbb3841a6dd4ec3d84b098437e35f41d41e8407 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Fri, 23 Jun 2017 20:55:05 +0900 Subject: [PATCH] Add prefix to setting toggle ID (#3907) --- .../components/column_settings.js | 6 ++--- .../components/column_settings.js | 24 +++++++++---------- .../components/setting_toggle.js | 9 +++---- 3 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/javascript/mastodon/features/home_timeline/components/column_settings.js b/app/javascript/mastodon/features/home_timeline/components/column_settings.js index 104d8ff37..ba870a360 100644 --- a/app/javascript/mastodon/features/home_timeline/components/column_settings.js +++ b/app/javascript/mastodon/features/home_timeline/components/column_settings.js @@ -28,17 +28,17 @@ class ColumnSettings extends React.PureComponent {
- } /> + } />
- } /> + } />
- +
); diff --git a/app/javascript/mastodon/features/notifications/components/column_settings.js b/app/javascript/mastodon/features/notifications/components/column_settings.js index 7bfd02f11..13ac78826 100644 --- a/app/javascript/mastodon/features/notifications/components/column_settings.js +++ b/app/javascript/mastodon/features/notifications/components/column_settings.js @@ -31,33 +31,33 @@ class ColumnSettings extends React.PureComponent {
- - - + + +
- - - + + +
- - - + + +
- - - + + +
); diff --git a/app/javascript/mastodon/features/notifications/components/setting_toggle.js b/app/javascript/mastodon/features/notifications/components/setting_toggle.js index a37abbd9c..aefc14ee3 100644 --- a/app/javascript/mastodon/features/notifications/components/setting_toggle.js +++ b/app/javascript/mastodon/features/notifications/components/setting_toggle.js @@ -6,19 +6,20 @@ import Toggle from 'react-toggle'; class SettingToggle extends React.PureComponent { static propTypes = { + prefix: PropTypes.string, settings: ImmutablePropTypes.map.isRequired, settingKey: PropTypes.array.isRequired, label: PropTypes.node.isRequired, onChange: PropTypes.func.isRequired, } - onChange = (e) => { - this.props.onChange(this.props.settingKey, e.target.checked); + onChange = ({ target }) => { + this.props.onChange(this.props.settingKey, target.checked); } render () { - const { settings, settingKey, label, onChange } = this.props; - const id = `setting-toggle-${settingKey.join('-')}`; + const { prefix, settings, settingKey, label, onChange } = this.props; + const id = ['setting-toggle', prefix, ...settingKey].filter(Boolean).join('-'); return (