wix-style-react
Version:
88 lines (72 loc) • 1.95 kB
JavaScript
import React from 'react';
import {
header,
tabs,
tab,
description,
importExample,
title,
divider,
example,
playground,
api,
testkit,
} from 'wix-storybook-utils/Sections';
import FormField from '../../FormField';
import Input from '../../Input';
import { storySettings } from '../test/storySettings';
import * as examples from './examples';
import Collapse from '..';
const exampleChildren = [
{ label: 'Simple text', value: 'Lorem perferendis sapiente quas facilis!' },
{
label: 'FormField with Input',
value: (
<FormField label="Enter your name">
<Input />
</FormField>
),
},
];
export default {
category: `${storySettings.category}|${storySettings.storyName}`,
storyName: 'Collapse',
component: Collapse,
componentPath: '..',
componentProps: {
children: 'Example text as a collapsible content',
open: true,
},
exampleProps: {
children: exampleChildren,
},
sections: [
header({
sourceUrl: `https://github.com/wix-private/wix-design-systems/tree/master/packages/wix-style-react/src/${Collapse.displayName}/`,
}),
tabs([
tab({
title: 'Description',
sections: [
description({
title: 'Description',
text: 'Collapse component is used to make content collapsible.<br/> Easily create accordions or within `<Card/>` to collapse its `<Card.Content/>`.',
}),
importExample(),
divider(),
title('Examples'),
example({
title: 'Simple Usage',
text: 'A simple example with compact preview. Children of the component become collapsible.',
source: examples.simple,
}),
],
}),
...[
{ title: 'API', sections: [api()] },
{ title: 'Testkit', sections: [testkit()] },
{ title: 'Playground', sections: [playground()] },
].map(tab),
]),
],
};