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: Remove drafts silliness from examples #1785

Merged
merged 18 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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
211 changes: 92 additions & 119 deletions docs/content/drafts/ActionList2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -50,156 +50,129 @@ import {ActionList} from '@primer/react/drafts'

### Minimal example

```javascript live noinline
// import {ActionList} from '@primer/react/drafts'
const {ActionList} = drafts // ignore docs silliness; import like that ↑

render(
<ActionList>
<ActionList.Item>New file</ActionList.Item>
<ActionList.Item>Copy link</ActionList.Item>
<ActionList.Item>Edit file</ActionList.Item>
<ActionList.Divider />
<ActionList.Item variant="danger">Delete file</ActionList.Item>
</ActionList>
)
```javascript live drafts
<ActionList>
<ActionList.Item>New file</ActionList.Item>
<ActionList.Item>Copy link</ActionList.Item>
<ActionList.Item>Edit file</ActionList.Item>
<ActionList.Divider />
<ActionList.Item variant="danger">Delete file</ActionList.Item>
</ActionList>
```

### With leading visual

Leading visuals are optional and appear at the start of an item. They can be octicons, avatars, and other custom visuals that fit a small area.

<!-- prettier-ignore -->
```javascript live noinline
// import {ActionList} from '@primer/react/drafts'
const {ActionList} = drafts // ignore docs silliness; import like that ↑
```javascript live drafts
<ActionList>
<ActionList.Item>
<ActionList.LeadingVisual><LinkIcon /></ActionList.LeadingVisual>
github.com/primer
</ActionList.Item>
<ActionList.Item variant="danger">
<ActionList.LeadingVisual><AlertIcon /></ActionList.LeadingVisual>
4 vulnerabilities
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual><Avatar src="https://github.com/mona.png" /></ActionList.LeadingVisual>
mona
</ActionList.Item>
</ActionList>

render(
<ActionList>
<ActionList.Item>
<ActionList.LeadingVisual><LinkIcon /></ActionList.LeadingVisual>
github.com/primer
</ActionList.Item>
<ActionList.Item variant="danger">
<ActionList.LeadingVisual><AlertIcon /></ActionList.LeadingVisual>
4 vulnerabilities
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual><Avatar src="https://github.com/mona.png" /></ActionList.LeadingVisual>
mona
</ActionList.Item>
</ActionList>
)
```

### With trailing visual

Trailing visual and trailing text can display auxiliary information. They're placed at the right of the item, and can denote status, keyboard shortcuts, or be used to set expectations about what the action does.

```javascript live noinline
// import {ActionList} from '@primer/react/drafts'
const {ActionList} = drafts // ignore docs silliness; import like that ↑

render(
<ActionList>
<ActionList.Item>
New file
<ActionList.TrailingVisual>⌘ + N</ActionList.TrailingVisual>
</ActionList.Item>
<ActionList.Item>
Copy link
<ActionList.TrailingVisual>⌘ + C</ActionList.TrailingVisual>
</ActionList.Item>
<ActionList.Item>
Edit file
<ActionList.TrailingVisual>⌘ + E</ActionList.TrailingVisual>
</ActionList.Item>
<ActionList.Item variant="danger">
Delete file
<ActionList.TrailingVisual>⌫</ActionList.TrailingVisual>
</ActionList.Item>
</ActionList>
)
```javascript live drafts
<ActionList>
<ActionList.Item>
New file
<ActionList.TrailingVisual>⌘ + N</ActionList.TrailingVisual>
</ActionList.Item>
<ActionList.Item>
Copy link
<ActionList.TrailingVisual>⌘ + C</ActionList.TrailingVisual>
</ActionList.Item>
<ActionList.Item>
Edit file
<ActionList.TrailingVisual>⌘ + E</ActionList.TrailingVisual>
</ActionList.Item>
<ActionList.Item variant="danger">
Delete file
<ActionList.TrailingVisual>⌫</ActionList.TrailingVisual>
</ActionList.Item>
</ActionList>
```

### With description and dividers

Item dividers allow users to parse heavier amounts of information. They're placed between items and are useful in complex lists, particularly when descriptions or multi-line text is present.

```javascript live noinline
// import {ActionList} from '@primer/react/drafts'
const {ActionList} = drafts // ignore docs silliness; import like that ↑

render(
<ActionList showDividers>
<ActionList.Item>
<ActionList.LeadingVisual>
<Avatar src="https://github.com/mona.png" />
</ActionList.LeadingVisual>
mona
<ActionList.Description>Monalisa Octocat</ActionList.Description>
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual>
<Avatar src="https://github.com/hubot.png" />
</ActionList.LeadingVisual>
hubot
<ActionList.Description>Hubot</ActionList.Description>
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual>
<Avatar src="https://github.com/primer-css.png" />
</ActionList.LeadingVisual>
primer-css
<ActionList.Description>GitHub Design Systems Bot</ActionList.Description>
</ActionList.Item>
</ActionList>
)
```javascript live drafts
<ActionList showDividers>
<ActionList.Item>
<ActionList.LeadingVisual>
<Avatar src="https://github.com/mona.png" />
</ActionList.LeadingVisual>
mona
<ActionList.Description>Monalisa Octocat</ActionList.Description>
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual>
<Avatar src="https://github.com/hubot.png" />
</ActionList.LeadingVisual>
hubot
<ActionList.Description>Hubot</ActionList.Description>
</ActionList.Item>
<ActionList.Item>
<ActionList.LeadingVisual>
<Avatar src="https://github.com/primer-css.png" />
</ActionList.LeadingVisual>
primer-css
<ActionList.Description>GitHub Design Systems Bot</ActionList.Description>
</ActionList.Item>
</ActionList>
```

### With links

When you want to add links to the List instead of actions, use `ActionList.LinkItem`

<!-- prettier-ignore -->
```javascript live noinline
// import {ActionList} from '@primer/react/drafts'
const {ActionList} = drafts // ignore docs silliness; import like that ↑

render(
<ActionList>
<ActionList.LinkItem href="https://github.com/primer">
<ActionList.LeadingVisual>
<LinkIcon />
</ActionList.LeadingVisual>
github/primer
</ActionList.LinkItem>
<ActionList.LinkItem as={ReactRouterLink} to="/">
<ActionList.LeadingVisual>
<LawIcon />
</ActionList.LeadingVisual>
MIT License
</ActionList.LinkItem>
<ActionList.LinkItem
href="https://github.com/primer/react/stargazers"
target="_blank"
rel="noopener noreferrer"
>
<ActionList.LeadingVisual>
<StarIcon />
</ActionList.LeadingVisual>
1.4k stars
</ActionList.LinkItem>
</ActionList>
)
```javascript live drafts
<ActionList>
<ActionList.LinkItem href="https://github.com/primer">
<ActionList.LeadingVisual>
<LinkIcon />
</ActionList.LeadingVisual>
github/primer
</ActionList.LinkItem>
<ActionList.LinkItem as={ReactRouterLink} to="/">
<ActionList.LeadingVisual>
<LawIcon />
</ActionList.LeadingVisual>
MIT License
</ActionList.LinkItem>
<ActionList.LinkItem
href="https://github.com/primer/react/stargazers"
target="_blank"
rel="noopener noreferrer"
>
<ActionList.LeadingVisual>
<StarIcon />
</ActionList.LeadingVisual>
1.4k stars
</ActionList.LinkItem>
</ActionList>
```

### With groups

```javascript live noinline
// import {ActionList} from '@primer/react/drafts'
const {ActionList} = drafts // ignore docs silliness; import like that ↑

```javascript live noinline drafts
const SelectFields = () => {
const [options, setOptions] = React.useState([
{text: 'Status', selected: true},
Expand Down
Loading