Open source video conferencing app powered by LiveKit. Built with Django and React.
✨(front) add loader and icon props to Button
Nathan Vasseba873196c7f4
diff --git a/src/frontend/src/primitives/Button.tsx b/src/frontend/src/primitives/Button.tsxindex 8ee63d03..9e9cd1a2 100644--- a/src/frontend/src/primitives/Button.tsx+++ b/src/frontend/src/primitives/Button.tsx@@ -6,12 +6,15 @@ import { type RecipeVariantProps } from '@/styled-system/css'import { buttonRecipe, type ButtonRecipe } from './buttonRecipe'import { TooltipWrapper, type TooltipWrapperProps } from './TooltipWrapper'import { ReactNode } from 'react'+import { Loader } from './Loader'export type ButtonProps = RecipeVariantProps<ButtonRecipe> &RACButtonsProps &TooltipWrapperProps & {// Use tooltip as description below the button.description?: boolean+ } & {+ icon?: ReactNode}export const Button = ({@@ -20,13 +23,16 @@ export const Button = ({...props}: ButtonProps) => {const [variantProps, componentProps] = buttonRecipe.splitVariantProps(props)+ const { className, ...remainingComponentProps } = componentPropsreturn (<TooltipWrapper tooltip={tooltip} tooltipType={tooltipType}><RACButton- className={buttonRecipe(variantProps)}- {...(componentProps as RACButtonsProps)}+ className={[buttonRecipe(variantProps), className].join(' ')}+ {...(remainingComponentProps as RACButtonsProps)}>+ {!props.loading && props.icon}+ {props.loading && <Loader />}{componentProps.children as ReactNode}{props.description && <span>{tooltip}</span>}</RACButton>diff --git a/src/frontend/src/primitives/buttonRecipe.ts b/src/frontend/src/primitives/buttonRecipe.tsindex 6a713db5..30c83709 100644--- a/src/frontend/src/primitives/buttonRecipe.ts+++ b/src/frontend/src/primitives/buttonRecipe.ts@@ -11,6 +11,7 @@ export const buttonRecipe = cva({'&[data-disabled]': {cursor: 'default',},+ gap: '0.5rem',},variants: {size: {@@ -266,6 +267,9 @@ export const buttonRecipe = cva({width: 'full',},},+ loading: {+ true: {},+ },// some toggle buttons make more sense without a "pushed button" style when selected because their content changes to mark the stateshySelected: {true: {},