Skip to content

Commit

Permalink
Add example story
Browse files Browse the repository at this point in the history
- a unit test can't yet be meaningfully written for this (jsdom doesn't have the concept of `:root` or CSS variables), so this will have to do for now
  • Loading branch information
cee-chen committed Oct 3, 2023
1 parent 390de42 commit f4638cd
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { Meta, StoryObj } from '@storybook/react';

import { EuiHeader, EuiHeaderSection, EuiHeaderSectionItem } from '../header';
import { EuiPageTemplate } from '../page_template';
import { EuiBottomBar } from '../bottom_bar';
import { EuiFlyout } from '../flyout';
import { EuiButton } from '../button';
import { EuiTitle } from '../title';
Expand Down Expand Up @@ -469,6 +470,24 @@ export const FlyoutInFixedHeaders: Story = {
},
};

export const GlobalCSSVariable: Story = {
render: ({ ...args }) => (
<>
<EuiHeader position="fixed">
<EuiHeaderSection>
<EuiCollapsibleNavBeta {...args}>
This story tests the global `--euiCollapsibleNavOffset` CSS variable
</EuiCollapsibleNavBeta>
</EuiHeaderSection>
</EuiHeader>
<EuiBottomBar left="var(--euiCollapsibleNavOffset, 0)">
This text should be visible at all times and the bar position should
update dynamically based on the nav width (including on mobile)
</EuiBottomBar>
</>
),
};

export const CollapsedStateInLocalStorage: Story = {
render: () => {
const key = 'EuiCollapsibleNav__isCollapsed';
Expand Down

0 comments on commit f4638cd

Please sign in to comment.