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

docs: add short descriptions to some components #1966

Merged
merged 6 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
docs: add description and example to Collapse
  • Loading branch information
gui-santos committed Mar 21, 2022
commit cede55147a459a38f04b84f8a844e9781109a518
25 changes: 6 additions & 19 deletions packages/components/collapse/README.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ typescript: ./src/Collapse.tsx,
storybook: 'https://v4-f36-storybook.netlify.app/?path=/story/animation-collapse--basic'
---

import { Button, Text } from '@contentful/f36-components';
import { ExternalLinkIcon } from '@contentful/f36-icons';
Animate hiding and showing content.

Collapse is used to elegantly hide and show extended content programmatically.
Used in [Accordion](/components/accordion).

## Import

```jsx static=true
import { Collapse } from '@contentful/f36-components';
// or
import { Collapse } from '@contentful/f36-collapse';
```

## Examples
Expand All @@ -24,22 +25,8 @@ The collapse component is a basic component to show and hide content programmati

### Basic usage

```jsx
function CollapseExample() {
const [isExpanded, setIsExpanded] = React.useState(true);
return (
<div>
<Button onClick={() => setIsExpanded(!isExpanded)}>Toggle</Button>
<Collapse isExpanded={isExpanded}>
<Text>
Customers on the Team tier can pay with a credit card (American
Express, MasterCard or Visa). Enterprise customers have the choice of
paying with a credit card or wire transfer.
</Text>
</Collapse>
</div>
);
}
```jsx file=./examples/CollapseExample.tsx

```

## Props (API reference)
Expand Down
18 changes: 18 additions & 0 deletions packages/components/collapse/examples/CollapseExample.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';
import { Button, Collapse, Text } from '@contentful/f36-components';

export function CollapseExample() {
const [isExpanded, setIsExpanded] = React.useState(true);
return (
<div>
<Button onClick={() => setIsExpanded(!isExpanded)}>Toggle</Button>
<Collapse isExpanded={isExpanded}>
<Text>
Customers on the Team tier can pay with a credit card (American
Express, MasterCard or Visa). Enterprise customers have the choice of
paying with a credit card or wire transfer.
</Text>
</Collapse>
</div>
);
}