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

Add components examples in README.md files - Part 2 #8338

Merged
merged 42 commits into from
Aug 8, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9fda0fd
Components examples: Modal
mmtr Jul 31, 2018
3296d11
Components examples: Modal
mmtr Aug 2, 2018
1d6ad3e
Components examples assigned to const variables
mmtr Aug 2, 2018
b3dcc26
Components examples: Notice
mmtr Aug 3, 2018
e298099
Components examples: Panel
mmtr Aug 3, 2018
abe9a02
Components examples: Placeholder
mmtr Aug 3, 2018
68d9457
Components examples: Popover
mmtr Aug 3, 2018
e7c21e5
Components examples: QueryControls
mmtr Aug 3, 2018
48de4b4
Components examples: RadioControl
mmtr Aug 3, 2018
d764061
Components examples: RangeControl
mmtr Aug 3, 2018
183c7d1
Components examples: ResponsiveWrapper
mmtr Aug 3, 2018
0239415
Components examples: SandBox
mmtr Aug 3, 2018
6b2c8b2
Components examples: ScrollLock
mmtr Aug 3, 2018
308eefd
Components examples: SelectControl
mmtr Aug 3, 2018
32dafc0
Components examples: ServerSideRender
mmtr Aug 4, 2018
201ff80
Add metadata using YAML front matter so examples can be extracted
mmtr Aug 4, 2018
40d1d44
Add metadata using YAML front matter so examples can be extracted
mmtr Aug 4, 2018
f1debb9
Remove YAML front matter
mmtr Aug 4, 2018
04c2649
Components examples: SlotFill
mmtr Aug 4, 2018
f52ff8d
Components examples: Spinner
mmtr Aug 4, 2018
7cf6f08
Components examples: TabPanel
mmtr Aug 4, 2018
b541266
Components examples: TextControl
mmtr Aug 4, 2018
81ef947
Components examples: TextareaControl
mmtr Aug 4, 2018
5984848
Components examples: ToggleControl
mmtr Aug 4, 2018
aacb094
Components examples: Toolbar
mmtr Aug 4, 2018
2a75f76
Components examples: Tooltip
mmtr Aug 4, 2018
cb4d859
Components examples: TreeSelect
mmtr Aug 4, 2018
a0aca61
Components examples: NavigableContainer
mmtr Aug 4, 2018
e7f85bb
Components examples: navigateRegions
mmtr Aug 4, 2018
6bc6fbc
Components examples: withConstrainedTabbing
mmtr Aug 4, 2018
2b7c999
Components examples: withContext
mmtr Aug 4, 2018
4c387ce
Components examples: withFallbackStyles
mmtr Aug 4, 2018
9394810
Components examples: withFilters
mmtr Aug 4, 2018
0b0bba5
Components examples: withFocusOutside
mmtr Aug 4, 2018
8d5c451
Components examples: withFocusReturn
mmtr Aug 4, 2018
ed573aa
Components examples: withNotices
mmtr Aug 4, 2018
9a94a5b
Components examples: withSpokenMessages
mmtr Aug 4, 2018
89f0c1b
Components examples: withAPIData
mmtr Aug 5, 2018
5471769
Contributing guidelines for the components
mmtr Aug 5, 2018
c2e20b0
Contributing guidelines for the components
mmtr Aug 5, 2018
1d93a3b
Contributing guidelines for the components
mmtr Aug 5, 2018
33cbfae
Add dummy attributes to ServerSideRender example
mmtr Aug 6, 2018
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
Contributing guidelines for the components
  • Loading branch information
mmtr committed Aug 6, 2018
commit 1d93a3b9930442b3dad4696038f75ccb1803adcc
16 changes: 7 additions & 9 deletions packages/components/src/dashicon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@
```jsx
import { Dashicon } from '@wordpress/components';

const MyDashicon = () => {
return (
<div>
<Dashicon icon="admin-home" />
<Dashicon icon="products" />
<Dashicon icon="wordpress" />
</div>
);
}
const MyDashicon = () => (
<div>
<Dashicon icon="admin-home" />
<Dashicon icon="products" />
<Dashicon icon="wordpress" />
</div>
);
```
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const EnhancedComponent = withFocusReturn(
const MyComponentWithFocusReturn = withState( {
text: '',
} )( ( { text, setState } ) => {
const unmount = ( ) => {
const unmount = () => {
document.activeElement.blur();
setState( { text: '' } );
}
Expand Down
5 changes: 2 additions & 3 deletions packages/components/src/modal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ The modal is used to create an accessible modal over an application.
The following example shows you how to properly implement a modal. For the modal to properly work it's important you implement the close logic for the modal properly.

```jsx
import { Fragment } from '@wordpress/element';
import { Button, Modal } from '@wordpress/components';
import { withState } from '@wordpress/compose';

const MyModal = withState( {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much shorter 👍

isOpen: false,
} )( ( { isOpen, setState } ) => (
<Fragment>
<div>
<Button isDefault onClick={ () => setState( { isOpen: true } ) }>Open Modal</Button>
{ isOpen ?
<Modal
Expand All @@ -27,7 +26,7 @@ const MyModal = withState( {
</Button>
</Modal>
: null }
</Fragment>
</div>
) );
```

Expand Down
3 changes: 1 addition & 2 deletions packages/components/src/navigable-container/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
NavigableContainers
=============
# NavigableContainers

`NavigableContainer` is a React component to render a container navigable using the keyboard. Only things that are focusable can be navigated to. It will currently always be a `div`.

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/notice/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MyNotice = () => (
For more complex markup, you can pass any JSX element:

```jsx
const MyComplexNotice = () => (
const MyNotice = () => (
<Notice status="error">
<p>An error occurred: <code>{ errorDetails }</code>.</p>
</Notice>
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/scroll-lock/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const MyScrollLock = withState( {
<div>
<Button isDefault onClick={ toggleLock }>
Toggle scroll lock
{ isScrollLocked && <ScrollLock /> }
</Button>
{ isScrollLocked && <ScrollLock /> }
<p>Scroll locked: <strong>{ isScrollLocked ? 'Yes' : 'No' }</strong></p>
</div>
);
Expand Down