From 2e82960ae63a530165d23d80ba7e95c0df64700f Mon Sep 17 00:00:00 2001 From: Timo K Date: Sat, 2 Jul 2022 21:20:53 +0200 Subject: [PATCH] ButtonVariant ButtonSize --- src/button/Button.tsx | 71 ++++++++++++++++++++++++++++++++++----- src/button/CopyButton.tsx | 4 +-- src/button/LinkButton.tsx | 11 ++++-- 3 files changed, 72 insertions(+), 14 deletions(-) diff --git a/src/button/Button.tsx b/src/button/Button.tsx index 3c2bc82..2f7ba3a 100644 --- a/src/button/Button.tsx +++ b/src/button/Button.tsx @@ -31,6 +31,19 @@ import { ReactComponent as AddUserIcon } from "../icons/AddUser.svg"; import { ReactComponent as ArrowDownIcon } from "../icons/ArrowDown.svg"; import { TooltipTrigger } from "../Tooltip"; +export type ButtonVariant = + | "default" + | "toolbar" + | "toolbarSecondary" + | "icon" + | "secondary" + | "copy" + | "secondaryCopy" + | "iconCopy" + | "secondaryHangup" + | "dropdown" + | "link"; + export const variantToClassName = { default: [styles.button], toolbar: [styles.toolbarButton], @@ -45,12 +58,14 @@ export const variantToClassName = { link: [styles.linkButton], }; -export const sizeToClassName = { +export type ButtonSize = "lg"; + +export const sizeToClassName: { lg: string[] } = { lg: [styles.lg], }; interface Props { - variant: string; - size: number; + variant: ButtonVariant; + size: ButtonSize; on: () => void; off: () => void; iconStyle: string; @@ -113,7 +128,13 @@ export const Button = forwardRef( } ); -export function MicButton({ muted, ...rest }) { +export function MicButton({ + muted, + ...rest +}: { + muted: boolean; + [index: string]: unknown; +}) { return (