diff --git a/src/frontend/src/primitives/Button.tsx b/src/frontend/src/primitives/Button.tsx index 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 & 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 } = componentProps return ( + {!props.loading && props.icon} + {props.loading && } {componentProps.children as ReactNode} {props.description && {tooltip}} diff --git a/src/frontend/src/primitives/buttonRecipe.ts b/src/frontend/src/primitives/buttonRecipe.ts index 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 state shySelected: { true: {},