|
| 1 | +import { Breadcrumbs } from '@automattic/components/src/breadcrumbs'; |
| 2 | +import { Meta, StoryObj } from '@storybook/react'; |
| 3 | +import { Button, Icon, DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components'; |
| 4 | +import { help, wordpress, moreVertical } from '@wordpress/icons'; |
| 5 | +import { PageHeader } from './index'; |
| 6 | + |
| 7 | +const meta = { |
| 8 | + title: 'client/dashboard/PageHeader', |
| 9 | + component: PageHeader, |
| 10 | + tags: [ 'autodocs' ], |
| 11 | + parameters: { |
| 12 | + actions: { argTypesRegex: '^on.*' }, |
| 13 | + }, |
| 14 | +} satisfies Meta< typeof PageHeader >; |
| 15 | + |
| 16 | +export default meta; |
| 17 | +type Story = StoryObj< typeof meta >; |
| 18 | + |
| 19 | +export const Default: Story = { |
| 20 | + args: { |
| 21 | + title: 'Settings', |
| 22 | + description: 'Configure your application settings', |
| 23 | + }, |
| 24 | +}; |
| 25 | + |
| 26 | +export const WithActions: Story = { |
| 27 | + args: { |
| 28 | + title: 'Site Settings', |
| 29 | + description: `Manage how your site works and appears. Configure your site's basic functionality, |
| 30 | + appearance, and behavior. These settings control everything from your site title to how your |
| 31 | + content is displayed to visitors.`, |
| 32 | + actions: ( |
| 33 | + <> |
| 34 | + <Button variant="secondary">Cancel</Button> |
| 35 | + <Button variant="primary">Save Changes</Button> |
| 36 | + </> |
| 37 | + ), |
| 38 | + }, |
| 39 | +}; |
| 40 | + |
| 41 | +export const ImageDecoration: Story = { |
| 42 | + args: { |
| 43 | + title: 'Site Customization', |
| 44 | + description: 'Make your site look exactly how you want it to', |
| 45 | + decoration: <img src="https://placecats.com/300/200" alt="Cat" />, |
| 46 | + actions: ( |
| 47 | + <> |
| 48 | + <Button variant="secondary">Cancel</Button> |
| 49 | + <Button variant="primary">Save Changes</Button> |
| 50 | + </> |
| 51 | + ), |
| 52 | + }, |
| 53 | +}; |
| 54 | + |
| 55 | +export const FullExample: Story = { |
| 56 | + args: { |
| 57 | + title: 'Site Customization', |
| 58 | + description: 'Make your site look exactly how you want it to', |
| 59 | + decoration: <Icon icon={ wordpress } />, |
| 60 | + breadcrumbs: ( |
| 61 | + <Breadcrumbs |
| 62 | + items={ [ |
| 63 | + { label: 'Dashboard', href: 'javascript:void(0)' }, |
| 64 | + { label: 'Appearance', href: 'javascript:void(0)' }, |
| 65 | + { label: 'Customize', href: 'javascript:void(0)' }, |
| 66 | + { label: 'Theme', href: 'javascript:void(0)' }, |
| 67 | + { label: 'Advanced', href: 'javascript:void(0)' }, |
| 68 | + ] } |
| 69 | + /> |
| 70 | + ), |
| 71 | + actions: ( |
| 72 | + <> |
| 73 | + <Button icon={ help } variant="tertiary" __next40pxDefaultSize> |
| 74 | + Help |
| 75 | + </Button> |
| 76 | + <Button variant="secondary" __next40pxDefaultSize> |
| 77 | + Preview |
| 78 | + </Button> |
| 79 | + <DropdownMenu |
| 80 | + icon={ moreVertical } |
| 81 | + label="More actions" |
| 82 | + toggleProps={ { __next40pxDefaultSize: true } } |
| 83 | + > |
| 84 | + { () => ( |
| 85 | + <> |
| 86 | + <MenuGroup> |
| 87 | + <MenuItem>Import</MenuItem> |
| 88 | + <MenuItem>Export</MenuItem> |
| 89 | + <MenuItem>Settings</MenuItem> |
| 90 | + </MenuGroup> |
| 91 | + <MenuGroup> |
| 92 | + <MenuItem>Help</MenuItem> |
| 93 | + </MenuGroup> |
| 94 | + </> |
| 95 | + ) } |
| 96 | + </DropdownMenu> |
| 97 | + </> |
| 98 | + ), |
| 99 | + }, |
| 100 | +}; |
0 commit comments