Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
96 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
<CounterButton/> | ||
```js | ||
<CounterButton/> | ||
``` |
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
Each example has its own state that you can access at the `state` variable and change with the `setState` function. Default state is `{}`. | ||
|
||
<div> | ||
<button onClick={() => setState({isOpen: true})}>Open</button> | ||
<Modal isOpen={state.isOpen}> | ||
<h1>Hallo!</h1> | ||
<button onClick={() => setState({isOpen: false})}>Close</button> | ||
</Modal> | ||
</div> | ||
```jsx | ||
<div> | ||
<button onClick={() => setState({isOpen: true})}>Open</button> | ||
<Modal isOpen={state.isOpen}> | ||
<h1>Hallo!</h1> | ||
<button onClick={() => setState({isOpen: false})}>Close</button> | ||
</Modal> | ||
</div> | ||
``` | ||
|
||
If you want to set the default state you can do something like that: | ||
|
||
initialState = {count: 1}; | ||
<button onClick={() => setState({count: state.count+1})}>{state.count}</button> | ||
```jsx | ||
initialState = {count: 1}; | ||
<button onClick={() => setState({count: state.count+1})}>{state.count}</button> | ||
``` |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<Placeholder type="beard"/> | ||
```jsx | ||
<Placeholder type="beard"/> | ||
``` |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
You can `require` external files in your examples: | ||
|
||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
```jsx | ||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
``` |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Enhanced/Decorated components work as well: | ||
|
||
<WrappedButton>I'm a wrapped button</WrappedButton> | ||
```jsx | ||
<WrappedButton>I'm a wrapped button</WrappedButton> | ||
``` |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<Placeholder type="beard"/> | ||
```jsx | ||
<Placeholder type="beard"/> | ||
``` |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
You can `require` external files in your examples: | ||
|
||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
```jsx | ||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
``` |
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
Each example has its own state that you can access at the `state` variable and change with the `setState` function. Default state is `{}`. | ||
|
||
<div> | ||
<button onClick={() => setState({isOpen: true})}>Open</button> | ||
<Modal isOpen={state.isOpen}> | ||
<h1>Hallo!</h1> | ||
<button onClick={() => setState({isOpen: false})}>Close</button> | ||
</Modal> | ||
</div> | ||
```jsx | ||
<div> | ||
<button onClick={() => setState({isOpen: true})}>Open</button> | ||
<Modal isOpen={state.isOpen}> | ||
<h1>Hallo!</h1> | ||
<button onClick={() => setState({isOpen: false})}>Close</button> | ||
</Modal> | ||
</div> | ||
``` | ||
|
||
If you want to set the default state you can do something like that: | ||
|
||
initialState = {count: 1}; | ||
<button onClick={() => setState({count: state.count+1})}>{state.count}</button> | ||
```jsx | ||
initialState = {count: 1}; | ||
<button onClick={() => setState({count: state.count+1})}>{state.count}</button> | ||
``` |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<Placeholder type="beard"/> | ||
```jsx | ||
<Placeholder type="beard"/> | ||
``` |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
You can `require` external files in your examples: | ||
|
||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
```jsx | ||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
``` |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<CounterButton/> | ||
```jsx | ||
<CounterButton/> | ||
``` |
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 |
---|---|---|
@@ -1,14 +1,18 @@ | ||
Each example has its own state that you can access at the `state` variable and change with the `setState` function. Default state is `{}`. | ||
|
||
<div> | ||
<button onClick={() => setState({isOpen: true})}>Open</button> | ||
<Modal isOpen={state.isOpen}> | ||
<h1>Hallo!</h1> | ||
<button onClick={() => setState({isOpen: false})}>Close</button> | ||
</Modal> | ||
</div> | ||
```jsx | ||
<div> | ||
<button onClick={() => setState({isOpen: true})}>Open</button> | ||
<Modal isOpen={state.isOpen}> | ||
<h1>Hallo!</h1> | ||
<button onClick={() => setState({isOpen: false})}>Close</button> | ||
</Modal> | ||
</div> | ||
``` | ||
|
||
If you want to set the default state you can do something like that: | ||
|
||
initialState = {count: 1}; | ||
<button onClick={() => setState({count: state.count+1})}>{state.count}</button> | ||
```jsx | ||
initialState = {count: 1}; | ||
<button onClick={() => setState({count: state.count+1})}>{state.count}</button> | ||
``` |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<Placeholder type="beard"/> | ||
```jsx | ||
<Placeholder type="beard"/> | ||
``` |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
You can `require` external files in your examples: | ||
|
||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
```jsx | ||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
``` |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Enhanced/Decorated components work as well: | ||
|
||
<WrappedButton>I'm a wrapped button</WrappedButton> | ||
```jsx | ||
<WrappedButton>I'm a wrapped button</WrappedButton> | ||
``` |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Should use the `fantasy` font inherited from `body`: | ||
|
||
<Label /> | ||
```jsx | ||
<Label /> | ||
``` |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Extra example file linked via `@example` doclet: | ||
|
||
<Placeholder type="bear"/> | ||
```jsx | ||
<Placeholder type="bear"/> | ||
``` |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<Placeholder type="beard"/> | ||
```jsx | ||
<Placeholder type="beard"/> | ||
``` |
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
<Placeholder type="beard"/> | ||
```jsx | ||
<Placeholder type="beard"/> | ||
``` |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
You can `require` external files in your examples: | ||
|
||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
```jsx | ||
const names = require('dog-names').all; | ||
<RandomButton variants={names}/> | ||
``` |