2018-05-02 15:55:25 +00:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import './Sondage.css'
|
|
|
|
import { connect } from 'react-redux'
|
|
|
|
import Smiley from './SatisfactionSmiley'
|
2018-05-03 13:24:19 +00:00
|
|
|
import TypeFormEmbed from './TypeFormEmbed'
|
|
|
|
import Overlay from './Overlay'
|
2018-05-02 15:55:25 +00:00
|
|
|
|
|
|
|
@connect(state => ({
|
|
|
|
targets: state.analysis ? state.analysis.targets : [],
|
|
|
|
activeInput: state.activeTargetInput
|
|
|
|
}))
|
|
|
|
export default class extends Component {
|
2018-05-03 13:24:19 +00:00
|
|
|
state = { visible: true, modal: false }
|
|
|
|
onSmileyClick = satisfaction => this.setState({ modal: true, satisfaction })
|
|
|
|
|
2018-05-02 15:55:25 +00:00
|
|
|
render() {
|
2018-05-03 13:24:19 +00:00
|
|
|
let { activeInput, targets } = this.props,
|
|
|
|
{ satisfaction, modal, visible } = this.state
|
2018-05-02 15:55:25 +00:00
|
|
|
|
|
|
|
if (!(activeInput && targets.length)) return null
|
2018-05-03 13:24:19 +00:00
|
|
|
if (!visible) return null
|
2018-05-02 15:55:25 +00:00
|
|
|
return (
|
|
|
|
<div id="sondage">
|
2018-05-03 13:24:19 +00:00
|
|
|
<Smiley text=":)" hoverColor="#16a085" onClick={this.onSmileyClick} />
|
|
|
|
<Smiley text=":|" hoverColor="#f39c12" onClick={this.onSmileyClick} />
|
|
|
|
<button onClick={() => this.setState({ visible: false })}>X</button>
|
|
|
|
{modal && (
|
|
|
|
<Overlay onOuterClick={() => this.setSate({ modal: false })}>
|
|
|
|
<TypeFormEmbed
|
|
|
|
hiddenVariables={{ exterieur: false, satisfaction }}
|
|
|
|
/>
|
|
|
|
</Overlay>
|
|
|
|
)}
|
2018-05-02 15:55:25 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|