From 2e0ee3fddfa15546f2db3ebf3ef3f9f7523a3db7 Mon Sep 17 00:00:00 2001 From: mama Date: Wed, 24 Jan 2018 10:35:07 +0100 Subject: [PATCH] =?UTF-8?q?Le=20second=20clic=20sur=20un=20choix=20de=20qu?= =?UTF-8?q?estion=20=C3=A0=20choix=20multiples=20le=20valide?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/conversation/Question.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/components/conversation/Question.js b/source/components/conversation/Question.js index d3e18b021..ea5f063fb 100644 --- a/source/components/conversation/Question.js +++ b/source/components/conversation/Question.js @@ -133,8 +133,16 @@ let RadioLabel = props => ( @HoverDecorator class RadioLabelContent extends Component { + state = { + active: null + } + click = value => () => { + this.props.setFormValue(value) + if (this.state.active !== value) this.setState({ active: value }) + else this.props.submit() + } render() { - let { value, label, input, hover, themeColours, setFormValue } = this.props, + let { value, label, input, hover, themeColours } = this.props, // value = when(is(Object), prop('value'))(choice), labelStyle = Object.assign( value === input.value || hover @@ -149,7 +157,7 @@ class RadioLabelContent extends Component { setFormValue(value)} + onClick={this.click(value)} value={value} checked={value === input.value ? 'checked' : ''} />