Add device notifications enabled switch (#9324)

This commit is contained in:
Germain 2022-09-28 18:13:09 +01:00 committed by GitHub
parent 1a0dbbf192
commit e15ef9f3de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 251 additions and 31 deletions

View file

@ -18,12 +18,15 @@ import React from "react";
import classNames from "classnames";
import ToggleSwitch from "./ToggleSwitch";
import { Caption } from "../typography/Caption";
interface IProps {
// The value for the toggle switch
value: boolean;
// The translated label for the switch
label: string;
// The translated caption for the switch
caption?: string;
// Whether or not to disable the toggle switch
disabled?: boolean;
// True to put the toggle in front of the label
@ -38,8 +41,14 @@ interface IProps {
export default class LabelledToggleSwitch extends React.PureComponent<IProps> {
public render() {
// This is a minimal version of a SettingsFlag
let firstPart = <span className="mx_SettingsFlag_label">{ this.props.label }</span>;
const { label, caption } = this.props;
let firstPart = <span className="mx_SettingsFlag_label">
{ label }
{ caption && <>
<br />
<Caption>{ caption }</Caption>
</> }
</span>;
let secondPart = <ToggleSwitch
checked={this.props.value}
disabled={this.props.disabled}