Add Element Call room settings (#9347)

Co-authored-by: Robin <robin@robin.town>
This commit is contained in:
Šimon Brandner 2022-10-07 20:10:17 +02:00 committed by GitHub
parent 4ff9681408
commit 26a74a193f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 539 additions and 67 deletions

View file

@ -18,21 +18,27 @@ limitations under the License.
import React from "react";
import classNames from "classnames";
import AccessibleButton from "./AccessibleButton";
import AccessibleTooltipButton from "./AccessibleTooltipButton";
interface IProps {
// Whether or not this toggle is in the 'on' position.
checked: boolean;
// Title to use
title?: string;
// Whether or not the user can interact with the switch
disabled?: boolean;
// Tooltip to show
tooltip?: string;
// Called when the checked state changes. First argument will be the new state.
onChange(checked: boolean): void;
}
// Controlled Toggle Switch element, written with Accessibility in mind
export default ({ checked, disabled = false, onChange, ...props }: IProps) => {
export default ({ checked, disabled = false, title, tooltip, onChange, ...props }: IProps) => {
const _onClick = () => {
if (disabled) return;
onChange(!checked);
@ -45,14 +51,16 @@ export default ({ checked, disabled = false, onChange, ...props }: IProps) => {
});
return (
<AccessibleButton {...props}
<AccessibleTooltipButton {...props}
className={classes}
onClick={_onClick}
role="switch"
aria-checked={checked}
aria-disabled={disabled}
title={title}
tooltip={tooltip}
>
<div className="mx_ToggleSwitch_ball" />
</AccessibleButton>
</AccessibleTooltipButton>
);
};