ref(participants-pane) Use new button component (#11913)

This commit is contained in:
Robert Pintilii
2022-07-27 12:33:50 +03:00
committed by GitHub
parent b1a9d68cf5
commit 867d998d15
11 changed files with 116 additions and 262 deletions

View File

@@ -11,6 +11,11 @@ import { ButtonProps } from '../types';
interface IButtonProps extends ButtonProps {
/**
* Class name used for additional styles.
*/
className?: string,
/**
* Whether or not the button should be full width.
*/
@@ -24,12 +29,17 @@ interface IButtonProps extends ButtonProps {
/**
* Click callback.
*/
onClick: () => void;
onClick: (e?: React.MouseEvent<HTMLButtonElement>) => void;
/**
* Which size the button should be.
*/
size?: 'small' | 'medium' | 'large';
/**
* Data test id.
*/
testId?: string;
}
const useStyles = makeStyles((theme: Theme) => {
@@ -163,6 +173,7 @@ const useStyles = makeStyles((theme: Theme) => {
const Button = ({
accessibilityLabel,
className,
disabled,
fullWidth,
icon,
@@ -170,6 +181,7 @@ const Button = ({
label,
onClick,
size = 'medium',
testId,
type = BUTTON_TYPES.PRIMARY
}: IButtonProps) => {
const styles = useStyles();
@@ -180,7 +192,8 @@ const Button = ({
className = { clsx(styles.button, styles[type],
disabled && styles.disabled,
icon && !label && `${styles.iconButton} iconButton`,
styles[size], fullWidth && styles.fullWidth) }
styles[size], fullWidth && styles.fullWidth, className) }
data-testid = { testId }
disabled = { disabled }
{ ...(id ? { id } : {}) }
onClick = { onClick }