mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 19:32:27 +00:00
ref(ui-components) Improve native and web Switch (#12061)
Bring Switch component more in line Convert some files to TS
This commit is contained in:
@@ -3,28 +3,14 @@ import clsx from 'clsx';
|
||||
import React, { useCallback } from 'react';
|
||||
|
||||
import { isMobileBrowser } from '../../../environment/utils';
|
||||
import { SwitchProps } from '../types';
|
||||
|
||||
interface SwitchProps {
|
||||
|
||||
/**
|
||||
* Whether or not the toggle is on.
|
||||
*/
|
||||
checked: boolean;
|
||||
|
||||
/**
|
||||
* Whether or not the toggle is disabled.
|
||||
*/
|
||||
disabled?: boolean;
|
||||
interface Props extends SwitchProps {
|
||||
|
||||
/**
|
||||
* Id of the toggle.
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* Toggle change callback.
|
||||
*/
|
||||
onChange: (on?: boolean) => void;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles((theme: any) => {
|
||||
@@ -92,7 +78,7 @@ const useStyles = makeStyles((theme: any) => {
|
||||
};
|
||||
});
|
||||
|
||||
const Switch = ({ id, checked, disabled, onChange }: SwitchProps) => {
|
||||
const Switch = ({ id, checked, disabled, onChange }: Props) => {
|
||||
const styles = useStyles();
|
||||
const isMobile = isMobileBrowser();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user