Skip to content

Commit

Permalink
docs(ffe-collapse-react): added storybook example
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Hellstrand committed Sep 11, 2024
1 parent a2e135a commit 9660898
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions packages/ffe-collapse-react/src/Collapse.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { useState } from 'react';
import { Collapse } from './Collapse';
import type { StoryObj, Meta } from '@storybook/react';
import { ExpandButton } from '@sb1/ffe-buttons-react';

const meta: Meta<typeof Collapse> = {
title: 'components/collapse/Collapse',
component: Collapse,
tags: ['autodocs'],
argTypes: {},
};
export default meta;

type Story = StoryObj<typeof Collapse>;

export const Standard: Story = {
args: {},
render: function Render() {
const [isOpen, setOpen] = useState(false);

return (
<>
<ExpandButton
isExpanded={isOpen}
onClick={() => setOpen(!isOpen)}
>
{isOpen ? 'Collapse' : 'Expand'}
</ExpandButton>
<Collapse isOpen={isOpen}>
<div>
<p>Hello world</p>
<p>Hello world</p>
</div>
</Collapse>
</>
);
},
};

0 comments on commit 9660898

Please sign in to comment.