From 2b9bc0a066bd1c71861ba55a03f23ec7cfd23b50 Mon Sep 17 00:00:00 2001 From: mama Date: Tue, 7 Nov 2017 17:45:54 +0100 Subject: [PATCH 1/3] :art: Pas de marge entre les suggestions -> pas de sauts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit En passant la souris d'une suggestion à une autre, le texte "votre réponse" ne s'affiche plus --- source/components/conversation/conversation.css | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/components/conversation/conversation.css b/source/components/conversation/conversation.css index d95880a89..e5c7a8270 100644 --- a/source/components/conversation/conversation.css +++ b/source/components/conversation/conversation.css @@ -302,10 +302,9 @@ fieldset > .ignore { align-items: flex-end; } .step .inputSuggestions li { - margin-left: .6em; } .step .inputSuggestions a { - padding: .1em .6em; + padding: .1em .9em; font-weight: 600; } .step .inputSuggestions a:hover { From 42c081c59a80e71d16886c7ed4502f6edcb8554f Mon Sep 17 00:00:00 2001 From: mama Date: Tue, 7 Nov 2017 17:48:00 +0100 Subject: [PATCH 2/3] :sparkles: formattage de code --- source/components/conversation/Input.js | 109 ++++++++++++++---------- 1 file changed, 66 insertions(+), 43 deletions(-) diff --git a/source/components/conversation/Input.js b/source/components/conversation/Input.js index f93ae0de9..e2caf023e 100644 --- a/source/components/conversation/Input.js +++ b/source/components/conversation/Input.js @@ -1,5 +1,5 @@ -import React, {Component} from 'react' -import {FormDecorator} from './FormDecorator' +import React, { Component } from 'react' +import { FormDecorator } from './FormDecorator' import classnames from 'classnames' import R from 'ramda' @@ -10,44 +10,57 @@ export default class Input extends Component { } render() { let { - name, - input, - stepProps: {attributes, submit, valueType, suggestions}, - meta: { - touched, error, active, - }, - themeColours, - } = this.props, + name, + input, + stepProps: { attributes, submit, valueType, suggestions }, + meta: { touched, error, active }, + themeColours + } = this.props, answerSuffix = valueType.suffix, suffixed = answerSuffix != null, inputError = touched && error, - sendButtonDisabled = this.state.suggestedInput || !input.value || inputError + sendButtonDisabled = + this.state.suggestedInput || !input.value || inputError - if (typeof suggestions == 'string') - return return ( - key == 'Enter' && input.value && ( - !error ? - submit() : - input.onBlur() // blur will trigger the error - )} - /> - { suffixed && - ) } - renderSuggestions(themeColours){ - let {setFormValue, submit, suggestions} = this.props.stepProps + renderSuggestions(themeColours) { + let { setFormValue, submit, suggestions } = this.props.stepProps if (!suggestions) return null return ( - suggestions: -
    - {R.toPairs(suggestions).map(([text, value]) => -
  • setFormValue('' + value) && submit() && e.preventDefault()} - onMouseOver={() => setFormValue('' + value) && this.setState({suggestedInput: true})} - onMouseOut={() => setFormValue('') && this.setState({suggestedInput: false})} - style={{color: themeColours.colour}}> - {text} -
  • - )} -
-
) + + suggestions: +
    + {R.toPairs(suggestions).map(([text, value]) => ( +
  • + setFormValue('' + value) && submit() && e.preventDefault()} + onMouseOver={() => + setFormValue('' + value) && + this.setState({ suggestedInput: true })} + onMouseOut={() => + setFormValue('') && this.setState({ suggestedInput: false })} + style={{ color: themeColours.colour }} + > + + {text} + +
  • + ))} +
+
+ ) } } From 5b48a6426116adf21ed19fe867a047e5c88a5b3e Mon Sep 17 00:00:00 2001 From: mama Date: Tue, 7 Nov 2017 18:05:28 +0100 Subject: [PATCH 3/3] =?UTF-8?q?:bug:=20Les=20suggestions=20n'=C3=A9crasent?= =?UTF-8?q?=20plus=20les=20saisies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/components/conversation/Input.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/source/components/conversation/Input.js b/source/components/conversation/Input.js index e2caf023e..24ca2964a 100644 --- a/source/components/conversation/Input.js +++ b/source/components/conversation/Input.js @@ -6,7 +6,7 @@ import R from 'ramda' @FormDecorator('input') export default class Input extends Component { state = { - suggestedInput: false + hoverSuggestion: null } render() { let { @@ -19,8 +19,9 @@ export default class Input extends Component { answerSuffix = valueType.suffix, suffixed = answerSuffix != null, inputError = touched && error, + {hoverSuggestion} = this.state, sendButtonDisabled = - this.state.suggestedInput || !input.value || inputError + input.value == null || input.value == '' || inputError if (typeof suggestions == 'string') return @@ -84,11 +86,8 @@ export default class Input extends Component { key={value} onClick={e => setFormValue('' + value) && submit() && e.preventDefault()} - onMouseOver={() => - setFormValue('' + value) && - this.setState({ suggestedInput: true })} - onMouseOut={() => - setFormValue('') && this.setState({ suggestedInput: false })} + onMouseOver={() => this.setState({ hoverSuggestion: value })} + onMouseOut={() => this.setState({ hoverSuggestion: null })} style={{ color: themeColours.colour }} >