-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add components examples in README.md files - Part 1 (#8267)
* Components examples: Button * Components examples: ButtonGroup * Components examples: Dashicon * Components examples: Disabled * Components examples: Draggable * Components examples: ClipboardButton * Components examples: CheckboxControl * Components examples: BaseControl * Components examples: Autocomplete * Components examples: Adding imports and using functional components * Components examples: ColorPalette * Components examples: DropZone * Components examples: Dropdown * Components examples: DropdownMenu * Components examples: ExternalLink * Components examples: FocusableIframe * Components examples: FontSizePicker * Components examples: FormFileUpload * Components examples: FormToggle * Components examples: FormTokenField * Components examples: ColorIndicator * Components examples: IconButton * Components examples: KeyboardShortcuts * Components examples: MenuGroup and MenuItem * Components examples: MenuItemsChoice * Using hashes instead of equality signs for the README main header * Using https://wordpress.org instead of .com * Using checked property in the CheckboxControl example * Change text used in the ClipboardButton example * Better format in colors array used in the ColorPalette example * Placing variable in arrow function between parenthesis * Add a dynamic message to DropZone example * Code style according to linter in FocusableIframe example * Add missing semicolons to FontSizePicker example * Add fallbackFontSize to FontSizePicker example * Add missing whitespaces in suggestions array * Use MenuItem in MenuGroup example
- Loading branch information
Showing
26 changed files
with
431 additions
and
154 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# ButtonGroup | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { Button, ButtonGroup } from '@wordpress/components'; | ||
|
||
function MyButtonGroup() { | ||
return ( | ||
<ButtonGroup> | ||
<Button isPrimary>Button 1</Button> | ||
<Button isPrimary>Button 2</Button> | ||
</ButtonGroup> | ||
); | ||
} | ||
``` |
This file contains 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 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 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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# ClipboardButton | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { ClipboardButton } from '@wordpress/components'; | ||
import { withState } from '@wordpress/compose'; | ||
|
||
withState( { | ||
hasCopied: false, | ||
} )( ( { hasCopied, setState } ) => ( | ||
<ClipboardButton | ||
isPrimary | ||
text="Text to be copied." | ||
onCopy={ () => setState( { hasCopied: true } ) } | ||
onFinishCopy={ () => setState( { hasCopied: false } ) } | ||
> | ||
{ hasCopied ? 'Copied!' : 'Copy Text' } | ||
</ClipboardButton> | ||
) ) | ||
``` |
This file contains 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# ColorIndicator | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { ColorIndicator } from '@wordpress/components'; | ||
|
||
function MyColorIndicator() { | ||
return ( | ||
<ColorIndicator colorValue="#f00" /> | ||
); | ||
} | ||
``` |
This file contains 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# ColorPalette | ||
|
||
## Usage | ||
```jsx | ||
import { ColorPalette } from '@wordpress/components'; | ||
import { withState } from '@wordpress/compose'; | ||
|
||
withState( { | ||
color: '#f00', | ||
} )( ( { color, setState } ) => { | ||
const colors = [ | ||
{ name: 'red', color: '#f00' }, | ||
{ name: 'white', color: '#fff' }, | ||
{ name: 'blue', color: '#00f' }, | ||
]; | ||
|
||
return ( | ||
<ColorPalette | ||
colors={ colors } | ||
value={ color } | ||
onChange={ color => setState( { color } ) } | ||
/> | ||
) | ||
} ) | ||
``` |
This file contains 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Dashicon | ||
|
||
## Usage | ||
|
||
```jsx | ||
import { Dashicon } from '@wordpress/components'; | ||
|
||
function MyDashicons() { | ||
return ( | ||
<div> | ||
<Dashicon icon="admin-home" /> | ||
<Dashicon icon="products" /> | ||
<Dashicon icon="wordpress" /> | ||
</div> | ||
); | ||
} | ||
``` |
This file contains 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 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 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 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
Oops, something went wrong.