Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '6.0.0' into add-border-radius-prop
- Loading branch information
Showing
14 changed files
with
9,859 additions
and
7,903 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,4 @@ | ||
{ | ||
"trailingComma": "none", | ||
"arrowParens": "avoid" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,102 @@ | ||
import React, { Component } from "react"; | ||
import Switch from "../.."; | ||
|
||
export default class HandleIcon extends Component { | ||
constructor() { | ||
super(); | ||
this.state = { checked: false }; | ||
this.handleChange = this.handleChange.bind(this); | ||
} | ||
|
||
handleChange(checked) { | ||
this.setState({ checked }); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div className="example"> | ||
<h2>Handle icons</h2> | ||
<label htmlFor="handle-icons"> | ||
<span>Switch with handle icons</span> | ||
<Switch | ||
onChange={this.handleChange} | ||
checked={this.state.checked} | ||
className="react-switch" | ||
uncheckedIcon={false} | ||
checkedIcon={false} | ||
uncheckedHandleIcon={ | ||
<div | ||
style={{ | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
height: "100%", | ||
fontSize: 20 | ||
}} | ||
> | ||
☹ | ||
</div> | ||
} | ||
checkedHandleIcon={ | ||
<div | ||
style={{ | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
height: "100%", | ||
color: "red", | ||
fontSize: 18 | ||
}} | ||
> | ||
♥ | ||
</div> | ||
} | ||
id="handle-icons" | ||
/> | ||
</label> | ||
<pre> | ||
{` | ||
<label htmlFor="handle-icons"> | ||
<span>Switch with handle icons</span> | ||
<Switch | ||
onChange={this.handleChange} | ||
checked={this.state.checked} | ||
className="react-switch" | ||
uncheckedIcon={false} | ||
checkedIcon={false} | ||
uncheckedHandleIcon={ | ||
<div | ||
style={{ | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
height: "100%", | ||
fontSize: 20 | ||
}} | ||
> | ||
☹ | ||
</div> | ||
} | ||
checkedHandleIcon={ | ||
<div | ||
style={{ | ||
display: "flex", | ||
justifyContent: "center", | ||
alignItems: "center", | ||
height: "100%", | ||
color: "red", | ||
fontSize: 18 | ||
}} | ||
> | ||
♥ | ||
</div> | ||
} | ||
id="handle-icons" | ||
/> | ||
</label> | ||
`} | ||
</pre> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React, { useState } from "react"; | ||
import Switch from "../.."; | ||
|
||
const OnlyTurnedOn = () => { | ||
const [checked, setChecked] = useState(false); | ||
|
||
return ( | ||
<div className="example"> | ||
<h2>Switch which cannot be turned back off</h2> | ||
<label> | ||
<span> | ||
To illustrate how the switch handles when the state is not changed in | ||
response to user action | ||
</span> | ||
<Switch | ||
onChange={() => setChecked(true)} | ||
checked={checked} | ||
className="react-switch" | ||
/> | ||
</label> | ||
<pre> | ||
{` | ||
<Switch | ||
onChange={() => setChecked(true)} | ||
checked={checked} | ||
className="react-switch" | ||
/> | ||
`} | ||
</pre> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OnlyTurnedOn; |
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.