From 77b1a722d889b64067d99ed7bbb7c688969c4d43 Mon Sep 17 00:00:00 2001 From: Jake Dexheimer Date: Sun, 18 Jun 2017 23:24:20 -0700 Subject: [PATCH] Add toggle component --- components/Settings.js | 34 ++++++++++++---------------------- components/Toggle.js | 34 ++++++++++++++++++++++++++++++++++ components/Toolbar.js | 2 +- components/svg/Checkmark.js | 7 +++++++ 4 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 components/Toggle.js create mode 100644 components/svg/Checkmark.js diff --git a/components/Settings.js b/components/Settings.js index dee6519..6d0ebab 100644 --- a/components/Settings.js +++ b/components/Settings.js @@ -1,6 +1,10 @@ import React from 'react' import enhanceWithClickOutside from 'react-click-outside' import SettingsIcon from './svg/Settings' +import ThemeSelect from './ThemeSelect' +import Slider from './Slider' +import Toggle from './Toggle' +import { PALETTE } from '../lib/constants' class Settings extends React.Component { constructor(props) { @@ -26,23 +30,11 @@ class Settings extends React.Component {
-
- Theme -
-
-
-
-
-
-
- Drop shadow -
-
- Window controls -
-
- Padding (horizontal) -
+ + + + +
diff --git a/components/Toggle.js b/components/Toggle.js new file mode 100644 index 0000000..1768e92 --- /dev/null +++ b/components/Toggle.js @@ -0,0 +1,34 @@ +import React from 'react' +import Checkmark from './svg/Checkmark' + +export default class extends React.Component { + constructor(props) { + super() + this.state = { isEnabled: props.enabled || false } + this.toggle = this.toggle.bind(this) + } + + toggle() { + this.setState({ isEnabled: !this.state.isEnabled }) + } + + render() { + return ( +
+ {this.props.label} + { this.state.isEnabled ? : null } + +
+ ) + } +} diff --git a/components/Toolbar.js b/components/Toolbar.js index dc4dfd0..dae638b 100644 --- a/components/Toolbar.js +++ b/components/Toolbar.js @@ -13,7 +13,7 @@ const Toolbar = (props) => ( onChange={props.onBGChange} bg={props.bg} /> - +