diff --git a/src/components/page_template/page_template.stories.tsx b/src/components/page_template/page_template.stories.tsx index d864c3ac080..195d3667276 100644 --- a/src/components/page_template/page_template.stories.tsx +++ b/src/components/page_template/page_template.stories.tsx @@ -13,37 +13,53 @@ import { hideStorybookControls, moveStorybookControlsToCategory, } from '../../../.storybook/utils'; +import { EuiSkeletonText } from '../skeleton'; import { EuiButton } from '../button'; import { EuiText } from '../text'; -import { EuiPageHeaderProps } from '../page/page_header'; -import { EuiPageSectionProps } from '../page/page_section'; + import { EuiPageTemplate, EuiPageTemplateProps } from './page_template'; import { PAGE_DIRECTIONS } from './outer/page_outer'; -const headerContent = (props?: EuiPageHeaderProps) => ( +const headerContent = ( Button]} - description="header description" - tabs={[ - { label: 'Tab 1', isSelected: true }, - { - label: 'Tab 2', - }, - ]} - {...props} + description={ + + } + tabs={[{ label: 'Tab 1', isSelected: true }, { label: 'Tab 2' }]} /> ); -const sectionContent = (props?: EuiPageSectionProps) => ( - Section content +const sectionContent = ( + <> + + + + Stack EuiPageTemplate sections and headers to create your custom + content order. + + + + + + + ); -const sidebarContent = (props?: Partial) => ( - Sidebar content +const sidebarContent = ( + + + ); const bottomBarContent = ( - BottomBar content + ); const emptyPromptContent = ( @@ -51,26 +67,10 @@ const emptyPromptContent = ( title={Empty prompt!} footer={Button} > - EmptyPromp content + ); -const comboContent = ( - <> - - - - Stack EuiPageTemplate sections and headers to create your custom - content order. - - - - {headerContent()} - {sectionContent()} - {bottomBarContent} - -); - const meta: Meta = { title: 'Templates/EuiPageTemplate', component: EuiPageTemplate, @@ -89,29 +89,6 @@ const meta: Meta = { }, component: { control: 'text' }, contentBorder: { control: 'radio', options: [undefined, true, false] }, - restrictWidth: { - control: 'select', - options: [true, false, 500, 900, 1800, '25%', '50%', '75%'], - }, - children: { - control: 'select', - options: [ - 'Combo', - 'Header', - 'Section', - 'Sidebar', - 'BottomBar', - 'EmptyPrompt', - ], - mapping: { - Combo: comboContent, - Header: headerContent, - Section: sectionContent, - Sidebar: sidebarContent, - BottomBar: bottomBarContent, - EmptyPrompt: emptyPromptContent, - }, - }, }, args: { minHeight: '460px', @@ -139,57 +116,44 @@ type Story = StoryObj; export const Playground: Story = { args: { - children: 'Combo', + children: 'With everything', + }, + argTypes: { + restrictWidth: { + control: 'select', + options: [true, false, 500, 900, 1800, '25%', '50%', '75%'], + }, + children: { + control: 'select', + description: + 'For quicker testing, use the selection control to the right to select several examples of common EuiPageTemplate layouts', + options: [ + 'With everything', + 'Without sidebar', + 'Without header', + 'Without bottom bar', + 'With empty prompt content', + ], + mapping: { + 'With everything': [ + sidebarContent, + headerContent, + sectionContent, + bottomBarContent, + ], + 'Without sidebar': [headerContent, sectionContent, bottomBarContent], + 'Without header': [sidebarContent, sectionContent, bottomBarContent], + 'Without bottom bar': [sidebarContent, headerContent, sectionContent], + 'With empty prompt content': [ + sidebarContent, + headerContent, + emptyPromptContent, + bottomBarContent, + ], + }, + }, }, // using render() over args to ensure dynamic update on prop changes - render: (args) => , -}; - -export const WithSidebar: Story = { - render: (args) => ( - - {sidebarContent(args)} - {headerContent(args)} - - - - Stack EuiPageTemplate sections and headers to create your custom - content order. - - - - {sectionContent(args)} - {bottomBarContent} - - ), -}; -hideStorybookControls(WithSidebar, [ - 'children', - 'direction', - 'grow', - 'minHeight', - 'responsive', - 'component', - 'contentBorder', - 'mainProps', -]); - -export const WithEmptyPrompt: Story = { - render: (args) => ( - - {sidebarContent(args)} - {headerContent(args)} - {emptyPromptContent} - - ), + // Cee TODO: This doesn't appear to work for the `paddingSize` and `bottomBorder` props + // render: ({ ...args }) => , }; -hideStorybookControls(WithEmptyPrompt, [ - 'children', - 'direction', - 'grow', - 'minHeight', - 'responsive', - 'component', - 'contentBorder', - 'mainProps', -]);