Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 677
Docs: Remove drafts silliness from examples#1785
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
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
432176e
use doctocat from #332
siddharthkp 4c38478
make live-code a function
siddharthkp f2393bc
update docs
siddharthkp ef35e47
can make code inline now :)
siddharthkp 452352d
jsx instead of javascript
siddharthkp f29bec7
Make the variable for adding drafts to scope more explicit
siddharthkp 2f66352
Bring changes from 1778
siddharthkp 4cb7e09
Add drafts to nav
siddharthkp b954f84
Merge branch 'main' into siddharth/docs-dynamic-drafts-scope
siddharthkp abe8af6
disable eslint/no-redeclare for code blocks
siddharthkp de695a8
revert explicit scope flag :)
siddharthkp ac88543
update gatsby-theme-doctocat
siddharthkp d2e7b4d
Merge branch 'main' into siddharth/docs-dynamic-drafts-scope
siddharthkp fe26d64
Merge branch 'main' into siddharth/docs-dynamic-drafts-scope
siddharthkp 625d0c5
Merge branch 'main' into siddharth/docs-dynamic-drafts-scope
siddharthkp 485aa2c
sync lockfile
siddharthkp 07c9ad0
fix bad merge
siddharthkp 0c93480
make live-scope a function
siddharthkp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
| @@ -43,163 +43,139 @@ import InlineCode from '@primer/gatsby-theme-doctocat/src/components/inline-code | ||
| </Box> | ||
| ```js | ||
| import {ActionList} from '@primer/react/drafts' | ||
| // ESM | ||
| import {ActionList} from '@primer/react/lib-esm/drafts' | ||
| // or commonjs: | ||
| import {ActionList} from '@primer/react/lib/drafts' | ||
siddharthkp marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| ``` | ||
| ## Examples | ||
| ### 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> | ||
| ) | ||
| ```jsx 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 ↑ | ||
| ```jsx 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> | ||
| ) | ||
| ```jsx 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> | ||
| ) | ||
| ```jsx 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> | ||
| ) | ||
| ```jsx 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}, | ||
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this for code blocks so that we can write this block ⬇️ without adding a
// eslint-ignoreinside the code block