From f6fdb635da9294a9999b2d3f2295e1a850d7c6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Wed, 26 Oct 2016 11:55:27 +0100 Subject: [PATCH] initial toggle implementation --- ui/src/components/toggle/index.js | 36 +++++++++++++++++++++ ui/src/components/toggle/readme.md | 29 +++++++++++++++++ ui/src/components/toggle/style.css | 52 ++++++++++++++++++++++++++++++ ui/src/docs.js | 3 +- ui/src/index.js | 3 +- 5 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 ui/src/components/toggle/index.js create mode 100644 ui/src/components/toggle/readme.md create mode 100644 ui/src/components/toggle/style.css diff --git a/ui/src/components/toggle/index.js b/ui/src/components/toggle/index.js new file mode 100644 index 00000000..ec2e6577 --- /dev/null +++ b/ui/src/components/toggle/index.js @@ -0,0 +1,36 @@ +const classNames = require('classnames'); +const React = require('react'); +const styles = require('./style.css'); + +const Toggle = ({ + off = false, + className, + style +}) => { + const tgl = classNames( + className, + styles.toggle, + off ? styles.off : styles.on, + ); + + const btn = classNames( + className, + styles.btn + ); + + return ( +
+
+ + {off ? 'Off' : 'On'} + +
+ ); +}; + +Toggle.propTypes = { + className: React.PropTypes.string, + style: React.PropTypes.object +}; + +module.exports = Toggle; diff --git a/ui/src/components/toggle/readme.md b/ui/src/components/toggle/readme.md new file mode 100644 index 00000000..053f8d32 --- /dev/null +++ b/ui/src/components/toggle/readme.md @@ -0,0 +1,29 @@ +# `