diff --git a/web/src/components/ui/indicators/StatusIndicator.stories.tsx b/web/src/components/ui/indicators/StatusIndicator.stories.tsx new file mode 100644 index 000000000..26fa26ecf --- /dev/null +++ b/web/src/components/ui/indicators/StatusIndicator.stories.tsx @@ -0,0 +1,52 @@ +import type { Meta, StoryObj } from '@storybook/react'; +import { StatusIndicator } from './StatusIndicator'; + +const meta = { + title: 'Base/StatusIndicator', + component: StatusIndicator, + parameters: { + layout: 'centered' + }, + tags: ['autodocs'] +} satisfies Meta; + +export default meta; +type Story = StoryObj; + +export const Loading: Story = { + args: { + status: 'loading' + } +}; + +export const Completed: Story = { + args: { + status: 'completed' + } +}; + +export const Failed: Story = { + args: { + status: 'failed' + } +}; + +// Story that shows all states side by side +export const AllStates: Story = { + render: () => ( +
+
+ + Loading +
+
+ + Completed +
+
+ + Failed +
+
+ ) +}; diff --git a/web/src/components/ui/indicators/StatusIndicator.tsx b/web/src/components/ui/indicators/StatusIndicator.tsx index 8713cbabc..9573c766a 100644 --- a/web/src/components/ui/indicators/StatusIndicator.tsx +++ b/web/src/components/ui/indicators/StatusIndicator.tsx @@ -1,8 +1,7 @@ import React from 'react'; import { AnimatePresence, motion } from 'framer-motion'; -import { createStyles } from 'antd-style'; -import { CircleSpinnerLoader } from '@/components/ui/loaders/CircleSpinnerLoader'; -import { AppMaterialIcons } from '@/components/ui'; +import { RadioChecked, Radio, CircleWarning } from '../icons'; +import { cn } from '@/lib/classMerge'; const animationConfig = { initial: { opacity: 0 }, @@ -13,28 +12,24 @@ const animationConfig = { export const StatusIndicator: React.FC<{ status?: 'completed' | 'loading' | 'failed' }> = React.memo(({ status }) => { - const { styles, cx } = useStyles(); const inProgress = status === 'loading'; + const failed = status === 'failed'; return (
- {inProgress ? ( - - ) : ( - - )} + {failed ? : }
@@ -42,17 +37,3 @@ export const StatusIndicator: React.FC<{ status?: 'completed' | 'loading' | 'fai }); StatusIndicator.displayName = 'StatusIndicator'; - -const useStyles = createStyles(({ token, css }) => ({ - indicatorContainer: css` - width: 11px; - height: 11px; - border-radius: 100%; - - color: ${token.colorTextPlaceholder}; - - &.in-progress { - color: ${token.colorPrimary}; - } - ` -}));