|
| 1 | +import type { Meta, StoryObj } from '@storybook/react-vite'; |
| 2 | +import { search } from '@wordpress/icons'; |
| 3 | +import { Button, EmptyState } from '../..'; |
| 4 | + |
| 5 | +const meta: Meta< typeof EmptyState.Root > = { |
| 6 | + title: 'Design System/Components/EmptyState', |
| 7 | + component: EmptyState.Root, |
| 8 | + subcomponents: { |
| 9 | + 'EmptyState.Visual': EmptyState.Visual, |
| 10 | + 'EmptyState.Icon': EmptyState.Icon, |
| 11 | + 'EmptyState.Title': EmptyState.Title, |
| 12 | + 'EmptyState.Description': EmptyState.Description, |
| 13 | + 'EmptyState.Actions': EmptyState.Actions, |
| 14 | + }, |
| 15 | +}; |
| 16 | +export default meta; |
| 17 | + |
| 18 | +type Story = StoryObj< typeof EmptyState.Root >; |
| 19 | + |
| 20 | +export const Default: Story = { |
| 21 | + args: { |
| 22 | + children: ( |
| 23 | + <> |
| 24 | + <EmptyState.Icon icon={ search } /> |
| 25 | + <EmptyState.Title>No results found</EmptyState.Title> |
| 26 | + <EmptyState.Description> |
| 27 | + Try adjusting your search or filter to find what you're |
| 28 | + looking for. |
| 29 | + </EmptyState.Description> |
| 30 | + <EmptyState.Actions> |
| 31 | + <Button variant="outline">Clear filters</Button> |
| 32 | + <Button>Add item</Button> |
| 33 | + </EmptyState.Actions> |
| 34 | + </> |
| 35 | + ), |
| 36 | + }, |
| 37 | +}; |
| 38 | + |
| 39 | +export const WithCustomVisual: Story = { |
| 40 | + args: { |
| 41 | + children: ( |
| 42 | + <> |
| 43 | + <EmptyState.Visual> |
| 44 | + <svg |
| 45 | + width="50" |
| 46 | + height="50" |
| 47 | + viewBox="0 0 50 50" |
| 48 | + fill="none" |
| 49 | + xmlns="http://www.w3.org/2000/svg" |
| 50 | + > |
| 51 | + <circle cx="25" cy="25" r="25" fill="currentColor" /> |
| 52 | + </svg> |
| 53 | + </EmptyState.Visual> |
| 54 | + <EmptyState.Title>All caught up!</EmptyState.Title> |
| 55 | + <EmptyState.Description> |
| 56 | + You've completed all your tasks. Great work! |
| 57 | + </EmptyState.Description> |
| 58 | + <EmptyState.Actions> |
| 59 | + <Button>Create new task</Button> |
| 60 | + </EmptyState.Actions> |
| 61 | + </> |
| 62 | + ), |
| 63 | + }, |
| 64 | +}; |
0 commit comments