From 183079f7312dc812d7b70a01e490ef3827b2890c Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 17 Jul 2017 21:13:24 +0200 Subject: [web] options: add some styling, minor fixes --- web/src/js/components/Modal/Option.jsx | 47 ++++++++++++++++++++--------- web/src/js/components/Modal/OptionModal.jsx | 8 ++--- 2 files changed, 36 insertions(+), 19 deletions(-) (limited to 'web/src') diff --git a/web/src/js/components/Modal/Option.jsx b/web/src/js/components/Modal/Option.jsx index 1aca23c2..e2f6708f 100644 --- a/web/src/js/components/Modal/Option.jsx +++ b/web/src/js/components/Modal/Option.jsx @@ -16,11 +16,16 @@ BooleanOption.PropTypes = { } function BooleanOption({ value, onChange, ...props }) { return ( - onChange(e.target.checked)} - {...props} - /> +
+ +
) } @@ -37,6 +42,14 @@ function StringOption({ value, onChange, ...props }) { /> ) } +function Optional(Component) { + return function ({ onChange, ...props }) { + return onChange(x ? x : null)} + {...props} + /> + } +} NumberOption.PropTypes = { value: PropTypes.number.isRequired, @@ -81,7 +94,7 @@ function StringSequenceOption({ value, onChange, ...props }) { return