-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(ffe-collapse-react): added storybook example
- Loading branch information
Peter Hellstrand
committed
Sep 11, 2024
1 parent
a2e135a
commit 9660898
Showing
1 changed file
with
38 additions
and
0 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
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> | ||
</> | ||
); | ||
}, | ||
}; |