Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): update collapse page to use new layout #612

Merged
merged 1 commit into from
Oct 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 39 additions & 39 deletions packages/docs/pages/collapse.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
import { Collapse, H1, Panel, Text } from '@bigcommerce/big-design';
import React, { useState } from 'react';

import { CodePreview, PageNavigation } from '../components';
import { CodePreview, List } from '../components';
import { CollapsePropTable } from '../PropTables';

const CollapsePage = () => {
const items = [
{
id: 'examples',
title: 'Examples',
render: () => (
<Panel>
<Text>Allows for showing/hiding content.</Text>
<CodePreview>
{/* jsx-to-string:start */}
{function Example() {
const [title, setTitle] = useState('Show more');
const handleChange = (isOpen: boolean) => setTitle(isOpen ? 'Show less' : 'Show more');

return (
<>
<Collapse title={title} onCollapseChange={handleChange}>
<Text>
Ea tempor sunt amet labore proident dolor proident commodo in exercitation ea nulla sunt pariatur.
Nulla sunt ipsum do eu consectetur exercitation occaecat labore aliqua. Aute elit occaecat esse ea
fugiat esse. Reprehenderit sunt ea ea mollit commodo tempor amet fugiat.
</Text>
</Collapse>
</>
);
}}
{/* jsx-to-string:end */}
</CodePreview>
</Panel>
),
},
{
id: 'props',
title: 'Props',
render: () => <CollapsePropTable />,
},
];

return (
<>
<H1>Collapse</H1>

<PageNavigation items={items} />
<Panel header="Overview" headerId="overview">
<Text>The collapse component can hide/reveal content within a panel.</Text>
<Text bold>When to use it:</Text>
<List>
<List.Item>
Use collapse to reduce clutter, hiding non-essential information or options on a panel or modal.
</List.Item>
</List>
</Panel>

<Panel header="Implementation" headerId="implementation">
<Text>Allows for showing/hiding content.</Text>

<CodePreview>
{/* jsx-to-string:start */}
{function Example() {
const [title, setTitle] = useState('Show more');
const handleChange = (isOpen: boolean) => setTitle(isOpen ? 'Show less' : 'Show more');

return (
<>
<Collapse title={title} onCollapseChange={handleChange}>
<Text>
Ea tempor sunt amet labore proident dolor proident commodo in exercitation ea nulla sunt pariatur.
Nulla sunt ipsum do eu consectetur exercitation occaecat labore aliqua. Aute elit occaecat esse ea
fugiat esse. Reprehenderit sunt ea ea mollit commodo tempor amet fugiat.
</Text>
</Collapse>
</>
);
}}
{/* jsx-to-string:end */}
</CodePreview>
</Panel>

<Panel header="Props" headerId="props">
<CollapsePropTable renderPanel={false} />
</Panel>
</>
);
};
Expand Down