diff --git a/packages/design-system/lib/components/Button/Button.stories.tsx b/packages/design-system/lib/components/Button/Button.stories.tsx index 74924d1bf..e5a74c132 100644 --- a/packages/design-system/lib/components/Button/Button.stories.tsx +++ b/packages/design-system/lib/components/Button/Button.stories.tsx @@ -157,6 +157,13 @@ export const SecondaryDisabled: Story = { }, } +export const SecondaryLoading: Story = { + args: { + ...SecondaryDefault.args, + isPending: true, + }, +} + export const SecondaryLarge: Story = { args: { ...SecondaryDefault.args, diff --git a/packages/design-system/lib/components/Button/Button.tsx b/packages/design-system/lib/components/Button/Button.tsx index 324ffc166..12f859764 100644 --- a/packages/design-system/lib/components/Button/Button.tsx +++ b/packages/design-system/lib/components/Button/Button.tsx @@ -3,7 +3,6 @@ import { Loading, type LoadingProps } from '../Loading/Loading' import { variants } from './variants' import type { ButtonProps } from './types' -import styles from './button.module.css' export function Button({ variant, @@ -25,17 +24,19 @@ export function Button({ className, }) - let loadingType: LoadingProps['type'] = 'Dark' - - switch (color) { - case 'Primary': - loadingType = 'Dark' - break - case 'Inverted': + let loadingType: LoadingProps['type'] = 'White' + if (variant === 'Secondary') { + if (color === 'Inverted') { loadingType = 'White' - break - default: + } else { loadingType = 'Dark' + } + } else { + if (color === 'Inverted') { + loadingType = 'Dark' + } else { + loadingType = 'White' + } } return ( @@ -44,11 +45,7 @@ export function Button({ return ( <> {children} - {isPending && ( -
- -
- )} + {isPending && } ) }} diff --git a/packages/design-system/lib/components/Loading/Loading.tsx b/packages/design-system/lib/components/Loading/Loading.tsx index cf73959b1..169118ebf 100644 --- a/packages/design-system/lib/components/Loading/Loading.tsx +++ b/packages/design-system/lib/components/Loading/Loading.tsx @@ -2,6 +2,7 @@ import styles from './loading.module.css' import { VariantProps } from 'class-variance-authority' import { variants } from './variants' +import { ProgressBar } from 'react-aria-components' export interface LoadingProps extends VariantProps { size?: number @@ -13,22 +14,23 @@ export function Loading({ type, size = 20 }: LoadingProps) { }) return ( - - - - - - - - - - + + + + + + + + + + + + ) } diff --git a/packages/design-system/lib/components/Loading/loading.module.css b/packages/design-system/lib/components/Loading/loading.module.css index 6447c4f9c..e95810064 100644 --- a/packages/design-system/lib/components/Loading/loading.module.css +++ b/packages/design-system/lib/components/Loading/loading.module.css @@ -1,5 +1,6 @@ .loading { - display: inline-block; + display: flex; + align-items: center; } .dot {