From 6be1c2efb9f477c4cbe05edd5010e78186c8e748 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Sat, 15 Jul 2017 22:54:33 +0800 Subject: [web] Add simple validation and improve UI. --- web/src/js/components/Modal/OptionMaster.jsx | 57 +++++++++++++++++++++------- web/src/js/components/Modal/OptionModal.jsx | 3 -- web/src/js/ducks/options.js | 19 +++++++++- 3 files changed, 61 insertions(+), 18 deletions(-) (limited to 'web/src/js') diff --git a/web/src/js/components/Modal/OptionMaster.jsx b/web/src/js/components/Modal/OptionMaster.jsx index ac65a22a..32f5bb4b 100644 --- a/web/src/js/components/Modal/OptionMaster.jsx +++ b/web/src/js/components/Modal/OptionMaster.jsx @@ -1,5 +1,8 @@ import React, { Component } from 'react' import PropTypes from 'prop-types' +import { connect } from 'react-redux' +import classnames from 'classnames' +import { update as updateOptions } from '../../ducks/options' PureBooleanOption.PropTypes = { value: PropTypes.bool.isRequired, @@ -7,16 +10,12 @@ PureBooleanOption.PropTypes = { } function PureBooleanOption({ value, onChange, ...props}) { - let onFocus = () => { props.onFocus() }, - onBlur = () => { props.onBlur() }, - onMouseEnter = () => { props.onMouseEnter() }, + let onMouseEnter = () => { props.onMouseEnter() }, onMouseLeave = () => { props.onMouseLeave() } return ( @@ -35,8 +34,10 @@ function PureStringOption( { value, onChange, ...props }) { onMouseEnter = () => { props.onMouseEnter() }, onMouseLeave = () => { props.onMouseLeave() } return ( +
+
) } @@ -61,6 +63,7 @@ function PureNumberOption( {value, onChange, ...props }) { return (