-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from ngsru/rebase-on-hallister
Rebase on hallister
- Loading branch information
Showing
10 changed files
with
355 additions
and
59 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
27 changes: 27 additions & 0 deletions
27
src/components/modules/checkbox/examples/checkbox.examples.md
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,27 @@ | ||
A checkbox allows a user to select a value from a small set of options, often binary | ||
|
||
## Types | ||
|
||
```require | ||
./types.jsx | ||
``` | ||
|
||
### Radio - a lot of | ||
|
||
```require | ||
./radios.jsx | ||
``` | ||
|
||
## State | ||
|
||
### Read-only | ||
|
||
```require | ||
./read-only.jsx | ||
``` | ||
|
||
### Disabled | ||
|
||
```require | ||
./disabled.jsx | ||
``` |
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,73 @@ | ||
import React from 'react'; | ||
import Checkbox from '../checkbox'; | ||
import Form from '../../../collections/form/fields'; | ||
import Field from './../../../collections/form/form'; | ||
|
||
class MyCheckboxes extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
isCheckbox: false, | ||
isRadio: false, | ||
isSlider: false, | ||
isToggle: false | ||
} | ||
} | ||
|
||
onClickCheckbox(name) { | ||
this.setState({ | ||
[name]: !this.state[name] | ||
}); | ||
} | ||
|
||
render() { | ||
let { isCheckbox, isRadio, isSlider, isToggle } = this.state; | ||
|
||
return ( | ||
<Form> | ||
<Field> | ||
<Checkbox | ||
disabled | ||
checked={isCheckbox} | ||
onClick={this.onClickCheckbox.bind(this, 'isCheckbox')} | ||
> | ||
Disabled, you can test | ||
</Checkbox> | ||
</Field> | ||
<Field> | ||
<Checkbox | ||
disabled | ||
type="radio" | ||
checked={isRadio} | ||
onClick={this.onClickCheckbox.bind(this, 'isRadio')} | ||
> | ||
Disabled, you can test | ||
</Checkbox> | ||
</Field> | ||
<Field> | ||
<Checkbox | ||
disabled | ||
type="slider" | ||
checked={isSlider} | ||
onClick={this.onClickCheckbox.bind(this, 'isSlider')} | ||
> | ||
Disabled, you can test | ||
</Checkbox> | ||
</Field> | ||
<Field> | ||
<Checkbox | ||
disabled | ||
type="toggle" | ||
checked={isToggle} | ||
onClick={this.onClickCheckbox.bind(this, 'isToggle')} | ||
> | ||
Disabled, you can test | ||
</Checkbox> | ||
</Field> | ||
</Form> | ||
); | ||
} | ||
} | ||
|
||
<MyCheckboxes /> |
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,53 @@ | ||
import React from 'react'; | ||
import Checkbox from '../checkbox'; | ||
import Form from '../../../collections/form/fields'; | ||
import Fields from '../../../collections/form/Fields'; | ||
import Field from './../../../collections/form/form'; | ||
|
||
class MyRadios extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
value: null | ||
}; | ||
} | ||
|
||
onClickRadio(value) { | ||
this.setState({ | ||
value: value | ||
}); | ||
} | ||
|
||
render() { | ||
let { value } = this.state; | ||
|
||
return ( | ||
<Form> | ||
<Fields> | ||
<label>Omg bananas!</label> | ||
<Field> | ||
<Checkbox | ||
type="radio" | ||
checked={value === 'one'} | ||
onClick={this.onClickRadio.bind(this, 'one')} | ||
> | ||
One banana | ||
</Checkbox> | ||
</Field> | ||
<Field> | ||
<Checkbox | ||
type="radio" | ||
checked={value === 'two'} | ||
onClick={this.onClickRadio.bind(this, 'two')} | ||
> | ||
Two banana | ||
</Checkbox> | ||
</Field> | ||
</Fields> | ||
</Form> | ||
); | ||
} | ||
} | ||
|
||
<MyRadios /> |
Oops, something went wrong.