BetterDiscordApp-rauenzi/src/ui/settings/settingsgroup.js

23 lines
913 B
JavaScript
Raw Normal View History

2019-05-29 05:48:41 +02:00
import {SettingsCookie} from "data";
2019-05-30 07:06:17 +02:00
import {React} from "modules";
2019-05-28 23:27:25 +02:00
import SettingsTitle from "./title";
import Switch from "./switch";
2019-05-30 07:06:17 +02:00
export default class V2C_SettingsGroup extends React.Component {
2019-05-28 20:55:07 +02:00
constructor(props) {
super(props);
}
render() {
const {title, settings, button} = this.props;
2019-05-30 07:06:17 +02:00
const buttonComponent = button ? React.createElement("button", {key: "title-button", className: "bd-pfbtn", onClick: button.onClick}, button.title) : null;
return [React.createElement(SettingsTitle, {text: title}),
2019-05-28 20:55:07 +02:00
buttonComponent,
settings.map(setting => {
2019-05-30 07:06:17 +02:00
return React.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: SettingsCookie[setting.id], onChange: (id, checked) => {
2019-05-28 20:55:07 +02:00
this.props.onChange(id, checked);
}});
})];
}
}