-
Notifications
You must be signed in to change notification settings - Fork 839
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[architecture] Export subcomponents with
.
namespacing
- a la `EuiPageTemplate` + update stories to use namespaced components instead of direct imports + add stories for the new group component
- Loading branch information
Showing
4 changed files
with
143 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/components/collapsible_nav_beta/collapsible_nav_group/collapsible_nav_group.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0 and the Server Side Public License, v 1; you may not use this file except | ||
* in compliance with, at your election, the Elastic License 2.0 or the Server | ||
* Side Public License, v 1. | ||
*/ | ||
|
||
import React, { FunctionComponent, PropsWithChildren } from 'react'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import { EuiHeader, EuiHeaderSection } from '../../header'; | ||
import { EuiPageTemplate } from '../../page_template'; | ||
|
||
import { EuiCollapsibleNavBeta, EuiCollapsibleNavBetaProps } from '../'; | ||
import { | ||
EuiCollapsibleNavGroup, | ||
EuiCollapsibleNavGroupProps, | ||
} from './collapsible_nav_group'; | ||
|
||
const meta: Meta<EuiCollapsibleNavGroupProps> = { | ||
title: 'EuiCollapsibleNavBeta.Group', | ||
component: EuiCollapsibleNavGroup, | ||
parameters: { | ||
layout: 'fullscreen', | ||
}, | ||
args: { | ||
title: 'Elastic', | ||
icon: 'logoElastic', | ||
items: [ | ||
{ title: 'Get started', href: '#' }, | ||
{ title: 'Dashboards', href: '#' }, | ||
{ | ||
title: 'Explore', | ||
href: '#', | ||
items: [ | ||
{ title: 'Hello', href: '#' }, | ||
{ title: 'World', href: '#' }, | ||
], | ||
}, | ||
], | ||
}, | ||
argTypes: { | ||
wrapperProps: { control: 'object' }, | ||
}, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<EuiCollapsibleNavGroupProps>; | ||
|
||
const CollapsibleNavTemplate: FunctionComponent< | ||
PropsWithChildren & Partial<EuiCollapsibleNavBetaProps> | ||
> = ({ children, ...props }) => { | ||
return ( | ||
<> | ||
<EuiHeader position="fixed"> | ||
<EuiHeaderSection> | ||
<EuiCollapsibleNavBeta {...props}> | ||
<EuiCollapsibleNavBeta.Body>{children}</EuiCollapsibleNavBeta.Body> | ||
</EuiCollapsibleNavBeta> | ||
</EuiHeaderSection> | ||
</EuiHeader> | ||
<EuiPageTemplate> | ||
<EuiPageTemplate.Section>Hello world</EuiPageTemplate.Section> | ||
</EuiPageTemplate> | ||
</> | ||
); | ||
}; | ||
|
||
export const Playground: Story = { | ||
render: ({ ...args }) => ( | ||
<CollapsibleNavTemplate> | ||
<EuiCollapsibleNavBeta.Group {...args} /> | ||
</CollapsibleNavTemplate> | ||
), | ||
args: { | ||
wrapperProps: { 'data-test-subj': 'test' }, | ||
}, | ||
}; | ||
|
||
export const EdgeCaseTesting: Story = { | ||
render: ({ ...args }) => ( | ||
<CollapsibleNavTemplate initialIsCollapsed={true}> | ||
<EuiCollapsibleNavBeta.Item href="#" title="Test" icon="faceHappy" /> | ||
<EuiCollapsibleNavBeta.Item href="#" title="Test" icon="faceSad" /> | ||
<EuiCollapsibleNavBeta.Group {...args} /> | ||
<EuiCollapsibleNavBeta.Item href="#" title="Test" icon="faceHappy" /> | ||
<EuiCollapsibleNavBeta.Item href="#" title="Test" icon="faceSad" /> | ||
<EuiCollapsibleNavBeta.Group {...args} /> | ||
</CollapsibleNavTemplate> | ||
), | ||
args: { | ||
href: '#', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters