From 7a78970d10ab2dfc9b86dd30a76fb1513f43dd35 Mon Sep 17 00:00:00 2001
From: Jason <jason.daurus@gmail.com>
Date: Fri, 17 Jun 2016 07:07:38 +0800
Subject: [web] common

---
 web/src/js/components/common/ToggleButton.jsx | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
 create mode 100644 web/src/js/components/common/ToggleButton.jsx

(limited to 'web/src/js/components/common/ToggleButton.jsx')

diff --git a/web/src/js/components/common/ToggleButton.jsx b/web/src/js/components/common/ToggleButton.jsx
new file mode 100644
index 00000000..6027728b
--- /dev/null
+++ b/web/src/js/components/common/ToggleButton.jsx
@@ -0,0 +1,17 @@
+import React, { PropTypes } from 'react'
+
+ToggleButton.propTypes = {
+    checked: PropTypes.bool.isRequired,
+    onToggle: PropTypes.func.isRequired,
+    text: PropTypes.string.isRequired
+}
+
+export default function ToggleButton({ checked, onToggle, text }) {
+    return (
+        <div className={"btn btn-toggle " + (checked ? "btn-primary" : "btn-default")} onClick={onToggle}>
+            <i className={"fa fa-fw " + (checked ? "fa-check-square-o" : "fa-square-o")}/>
+            &nbsp;
+            {text}
+        </div>
+    )
+}
-- 
cgit v1.2.3

