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
81 changed files
with
2,004 additions
and
1,697 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,10 +1,28 @@ | ||
{ | ||
"presets": [ | ||
"env", | ||
["env", { | ||
"targets": { | ||
"uglify": true | ||
}, | ||
"modules": false | ||
}], | ||
"react" | ||
], | ||
"plugins": [ | ||
"transform-class-properties", | ||
"transform-object-rest-spread" | ||
] | ||
], | ||
"env": { | ||
"test": { | ||
"presets": [ | ||
"env", | ||
"react" | ||
], | ||
"plugins": [ | ||
"system-import-transformer", | ||
"transform-class-properties", | ||
"transform-object-rest-spread" | ||
] | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,37 @@ | ||
Basic button: | ||
|
||
<Button>Push Me</Button> | ||
```jsx | ||
<Button>Push Me</Button> | ||
``` | ||
|
||
Big pink button: | ||
|
||
<Button size="large" color="deeppink">Lick Me</Button> | ||
```jsx | ||
<Button size="large" color="deeppink">Lick Me</Button> | ||
``` | ||
|
||
And you *can* **use** `any` [Markdown](http://daringfireball.net/projects/markdown/) here. | ||
|
||
If you define a fenced code block with a language flag it will be rendered as a regular Markdown code snippet: | ||
Fenced code blocks with `js`, `jsx` or `javascript` languages are rendered as a interactive playgrounds: | ||
|
||
```jsx | ||
<Button>Push Me</Button> | ||
``` | ||
|
||
You can disable an editor by passing a `noeditor` modifier (```` ```js noeditor````): | ||
|
||
```javascript | ||
```jsx noeditor | ||
<Button>Push Me</Button> | ||
``` | ||
|
||
To render an example as highlighted source code add a `static` modifier: (```` ```js static````): | ||
|
||
```js static | ||
import React from 'react'; | ||
``` | ||
|
||
Fenced blocks with other languages are rendered as highlighted code: | ||
|
||
```html | ||
<h1>Hello world</h1> | ||
``` |
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,11 +1,19 @@ | ||
const loaders = require('loaders'); | ||
|
||
module.exports = { | ||
components: 'src/components/**/[A-Z]*.js', | ||
defaultExample: true, | ||
webpackConfig: { | ||
module: { | ||
loaders: loaders.all, | ||
rules: [ | ||
{ | ||
test: /\.jsx?$/, | ||
exclude: /node_modules/, | ||
loader: 'babel-loader', | ||
}, | ||
{ | ||
test: /\.css$/, | ||
loader: 'style-loader!css-loader', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; |
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,15 +1,37 @@ | ||
Basic button: | ||
|
||
<Button>Push Me</Button> | ||
```jsx | ||
<Button>Push Me</Button> | ||
``` | ||
|
||
Big pink button: | ||
|
||
<Button size="large" color="deeppink">Lick Me</Button> | ||
```jsx | ||
<Button size="large" color="deeppink">Lick Me</Button> | ||
``` | ||
|
||
And you *can* **use** `any` [Markdown](http://daringfireball.net/projects/markdown/) here. | ||
|
||
If you define a fenced code block with a language flag it will be rendered as a regular Markdown code snippet: | ||
Fenced code blocks with `js`, `jsx` or `javascript` languages are rendered as an interactive playgrounds: | ||
|
||
```jsx | ||
<Button>Push Me</Button> | ||
``` | ||
|
||
You can disable an editor by passing a `noeditor` modifier (```` ```js noeditor````): | ||
|
||
```javascript | ||
```jsx noeditor | ||
<Button>Push Me</Button> | ||
``` | ||
|
||
To render an example as highlighted source code add a `static` modifier (```` ```js static````): | ||
|
||
```js static | ||
import React from 'react'; | ||
``` | ||
|
||
Fenced blocks with other languages are rendered as highlighted code: | ||
|
||
```html | ||
<h1>Hello world</h1> | ||
``` |
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"/> | ||
``` |
Oops, something went wrong.