ButtonVariant ButtonSize
This commit is contained in:
parent
18ca92cec4
commit
2e82960ae6
3 changed files with 72 additions and 14 deletions
|
@ -31,6 +31,19 @@ import { ReactComponent as AddUserIcon } from "../icons/AddUser.svg";
|
||||||
import { ReactComponent as ArrowDownIcon } from "../icons/ArrowDown.svg";
|
import { ReactComponent as ArrowDownIcon } from "../icons/ArrowDown.svg";
|
||||||
import { TooltipTrigger } from "../Tooltip";
|
import { TooltipTrigger } from "../Tooltip";
|
||||||
|
|
||||||
|
export type ButtonVariant =
|
||||||
|
| "default"
|
||||||
|
| "toolbar"
|
||||||
|
| "toolbarSecondary"
|
||||||
|
| "icon"
|
||||||
|
| "secondary"
|
||||||
|
| "copy"
|
||||||
|
| "secondaryCopy"
|
||||||
|
| "iconCopy"
|
||||||
|
| "secondaryHangup"
|
||||||
|
| "dropdown"
|
||||||
|
| "link";
|
||||||
|
|
||||||
export const variantToClassName = {
|
export const variantToClassName = {
|
||||||
default: [styles.button],
|
default: [styles.button],
|
||||||
toolbar: [styles.toolbarButton],
|
toolbar: [styles.toolbarButton],
|
||||||
|
@ -45,12 +58,14 @@ export const variantToClassName = {
|
||||||
link: [styles.linkButton],
|
link: [styles.linkButton],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sizeToClassName = {
|
export type ButtonSize = "lg";
|
||||||
|
|
||||||
|
export const sizeToClassName: { lg: string[] } = {
|
||||||
lg: [styles.lg],
|
lg: [styles.lg],
|
||||||
};
|
};
|
||||||
interface Props {
|
interface Props {
|
||||||
variant: string;
|
variant: ButtonVariant;
|
||||||
size: number;
|
size: ButtonSize;
|
||||||
on: () => void;
|
on: () => void;
|
||||||
off: () => void;
|
off: () => void;
|
||||||
iconStyle: string;
|
iconStyle: string;
|
||||||
|
@ -113,7 +128,13 @@ export const Button = forwardRef<HTMLAnchorElement, Props>(
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export function MicButton({ muted, ...rest }) {
|
export function MicButton({
|
||||||
|
muted,
|
||||||
|
...rest
|
||||||
|
}: {
|
||||||
|
muted: boolean;
|
||||||
|
[index: string]: unknown;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Button variant="toolbar" {...rest} off={muted}>
|
<Button variant="toolbar" {...rest} off={muted}>
|
||||||
|
@ -124,7 +145,13 @@ export function MicButton({ muted, ...rest }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function VideoButton({ muted, ...rest }) {
|
export function VideoButton({
|
||||||
|
muted,
|
||||||
|
...rest
|
||||||
|
}: {
|
||||||
|
muted: boolean;
|
||||||
|
[index: string]: unknown;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Button variant="toolbar" {...rest} off={muted}>
|
<Button variant="toolbar" {...rest} off={muted}>
|
||||||
|
@ -135,7 +162,15 @@ export function VideoButton({ muted, ...rest }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ScreenshareButton({ enabled, className, ...rest }) {
|
export function ScreenshareButton({
|
||||||
|
enabled,
|
||||||
|
className,
|
||||||
|
...rest
|
||||||
|
}: {
|
||||||
|
enabled: boolean;
|
||||||
|
className: string;
|
||||||
|
[index: string]: unknown;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Button variant="toolbarSecondary" {...rest} on={enabled}>
|
<Button variant="toolbarSecondary" {...rest} on={enabled}>
|
||||||
|
@ -146,7 +181,13 @@ export function ScreenshareButton({ enabled, className, ...rest }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function HangupButton({ className, ...rest }) {
|
export function HangupButton({
|
||||||
|
className,
|
||||||
|
...rest
|
||||||
|
}: {
|
||||||
|
className: string;
|
||||||
|
[index: string]: unknown;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Button
|
<Button
|
||||||
|
@ -161,7 +202,13 @@ export function HangupButton({ className, ...rest }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function SettingsButton({ className, ...rest }) {
|
export function SettingsButton({
|
||||||
|
className,
|
||||||
|
...rest
|
||||||
|
}: {
|
||||||
|
className: string;
|
||||||
|
[index: string]: unknown;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Button variant="toolbar" {...rest}>
|
<Button variant="toolbar" {...rest}>
|
||||||
|
@ -172,7 +219,13 @@ export function SettingsButton({ className, ...rest }) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function InviteButton({ className, ...rest }) {
|
export function InviteButton({
|
||||||
|
className,
|
||||||
|
...rest
|
||||||
|
}: {
|
||||||
|
className: string;
|
||||||
|
[index: string]: unknown;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<TooltipTrigger>
|
<TooltipTrigger>
|
||||||
<Button variant="toolbar" {...rest}>
|
<Button variant="toolbar" {...rest}>
|
||||||
|
|
|
@ -19,13 +19,13 @@ import useClipboard from "react-use-clipboard";
|
||||||
|
|
||||||
import { ReactComponent as CheckIcon } from "../icons/Check.svg";
|
import { ReactComponent as CheckIcon } from "../icons/Check.svg";
|
||||||
import { ReactComponent as CopyIcon } from "../icons/Copy.svg";
|
import { ReactComponent as CopyIcon } from "../icons/Copy.svg";
|
||||||
import { Button } from "./Button";
|
import { Button, ButtonVariant } from "./Button";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value: string;
|
value: string;
|
||||||
children: JSX.Element;
|
children: JSX.Element;
|
||||||
className: string;
|
className: string;
|
||||||
variant: string;
|
variant: ButtonVariant;
|
||||||
copiedMessage: string;
|
copiedMessage: string;
|
||||||
}
|
}
|
||||||
export function CopyButton({
|
export function CopyButton({
|
||||||
|
|
|
@ -18,11 +18,16 @@ import React from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
import { variantToClassName, sizeToClassName } from "./Button";
|
import {
|
||||||
|
variantToClassName,
|
||||||
|
sizeToClassName,
|
||||||
|
ButtonVariant,
|
||||||
|
ButtonSize,
|
||||||
|
} from "./Button";
|
||||||
interface Props {
|
interface Props {
|
||||||
className: string;
|
className: string;
|
||||||
variant: string;
|
variant: ButtonVariant;
|
||||||
size: number;
|
size: ButtonSize;
|
||||||
children: JSX.Element;
|
children: JSX.Element;
|
||||||
[index: string]: unknown;
|
[index: string]: unknown;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue