Browse Source

Made the toggle block clickable

Keyi 8 years ago
parent
commit
62649679ae
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/components/Toggle/index.js

+ 3 - 3
src/components/Toggle/index.js

@@ -16,15 +16,15 @@ export default class Toggle extends React.Component {
 	render() {
 		return (
 			<div>
-				<h1>Try the toggole which controls the status and animation </h1>
+				<h2>Try the toggole which controls the status and animation. The block itself is also clickable.</h2>
 				<button onClick={this.handleClick}>
 				Toggle
 				</button>
-				<h2>Open: {this.state.open.toString()}</h2>
+				<h2>Status: {this.state.open? "open" : "closed"}</h2>
 				<Motion style={{x: spring(this.state.open ? 200 : 0)}}>
 				{({x}) => 
 					<div className="toggle-bg">
-					<div className="toggle-block" style={{
+					<div className="toggle-block" onClick={this.handleClick} style={{
 						transform: `translate3d(${x}px, 0, 0)`,
 					}}>
 					</div>