Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements in checkbox and adapt dependencies to stateless behavior
- Loading branch information
1 parent
24be10d
commit 1d9cde9
Showing
6 changed files
with
205 additions
and
122 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
41 changes: 34 additions & 7 deletions
41
docs/app/components/layout/main/modules/examples/checkbox_example_1.txt
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,9 +1,36 @@ | ||
const TestCheckbox = () => ( | ||
<div> | ||
<Checkbox label="Checked option" checked /> | ||
<Checkbox label="Unchecked option" /> | ||
<Checkbox label="Disabled checkbox" checked disabled /> | ||
</div> | ||
); | ||
class TestCheckbox extends React.Component { | ||
state = { | ||
check1: true, | ||
check2: false | ||
}; | ||
|
||
handleChange = (field) => { | ||
const newState = {}; | ||
newState[field] = !this.state[field]; | ||
this.setState(newState); | ||
}; | ||
|
||
render () { | ||
return ( | ||
<div> | ||
<Checkbox | ||
checked={this.state.check1} | ||
label="Checked option" | ||
onChange={this.handleChange.bind(this, 'check1')} | ||
/> | ||
<Checkbox | ||
checked={this.state.check2} | ||
label="Unchecked option" | ||
onChange={this.handleChange.bind(this, 'check2')} | ||
/> | ||
<Checkbox | ||
checked | ||
disabled | ||
label="Disabled checkbox" | ||
/> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
return <TestCheckbox />; |
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