From 2ee9bb0da5cbdbbcfcfe550c7d2b4e7be728f1e7 Mon Sep 17 00:00:00 2001 From: Jake Dexheimer Date: Mon, 3 Jul 2017 20:23:34 -0700 Subject: [PATCH] Wire up padding settings --- components/Settings.js | 2 +- components/Slider.js | 4 +++- components/Toggle.js | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/components/Settings.js b/components/Settings.js index bbbd9ff..75deb04 100644 --- a/components/Settings.js +++ b/components/Settings.js @@ -20,7 +20,7 @@ class Settings extends React.Component { } handleClickOutside() { - this.setState({ isVisible: false }); + this.setState({ isVisible: false }) } render() { diff --git a/components/Slider.js b/components/Slider.js index d31f5f1..733ad86 100644 --- a/components/Slider.js +++ b/components/Slider.js @@ -8,7 +8,9 @@ export default class extends React.Component { } handleChange(e) { - this.setState({ value: e.target.value }) + this.setState({ value: e.target.value }, () => { + this.props.onChange(`${this.state.value}px`) + }) } render() { diff --git a/components/Toggle.js b/components/Toggle.js index 4e510e3..4066989 100644 --- a/components/Toggle.js +++ b/components/Toggle.js @@ -9,8 +9,9 @@ export default class extends React.Component { } toggle() { - this.setState({ isEnabled: !this.state.isEnabled }) - this.props.onChange(this.state.isEnabled) + this.setState({ isEnabled: !this.state.isEnabled }, () => { + this.props.onChange(this.state.isEnabled) + }) } render() {