[infrance] scroll pour faire apparaitre la répartitions des cotisations lors de la première saisie du salaire

pull/294/head
Johan Girod 2018-08-06 14:26:53 +02:00
parent 30eced6643
commit 809b2cad5e
3 changed files with 10 additions and 4 deletions

View File

@ -1,4 +1,5 @@
import { startConversation } from 'Actions/actions'
import { ScrollToElement } from 'Components/utils/Scroll'
import withColours from 'Components/utils/withColours'
import withLanguage from 'Components/utils/withLanguage'
import React, { Component } from 'react'
@ -69,6 +70,7 @@ export default class Simu extends Component {
</button>
</div>
)}
{firstValidInputEntered && <ScrollToElement />}
<Spring
to={{
height: firstValidInputEntered ? 'auto' : 0,
@ -150,7 +152,9 @@ export default class Simu extends Component {
</Trans>
</p>
<p style={{ textAlign: 'center' }}>
<button className="ui__ button" onClick={startConversation}>
<button
className="ui__ button"
onClick={() => startConversation()}>
<Trans>Faire une simulation personnalisée</Trans>
</button>
</p>

View File

@ -1,4 +1,4 @@
import { ScrollToElement } from 'Components/utils/Scroll'
import Scroll from 'Components/utils/Scroll'
import { getInputComponent } from 'Engine/generateQuestions'
import React, { Component } from 'react'
import { translate } from 'react-i18next'
@ -30,10 +30,10 @@ export default class Conversation extends Component {
return (
<div className="conversationContainer">
<Aide />
<div id="currentQuestion" key={currentQuestion}>
<Scroll.toElement onlyIfNotVisible key={currentQuestion} />
<div id="currentQuestion">
{currentQuestion && (
<Animate.fadeIn>
<ScrollToElement onlyIfNotVisible />
{getInputComponent(flatRules, targetNames)(currentQuestion)}
</Animate.fadeIn>
)}

View File

@ -5,6 +5,7 @@ export class ScrollToTop extends Component {
behavior: 'auto'
}
componentDidMount() {
console.log('scrototop')
window.scroll({
top: 0,
behavior: this.props.behavior
@ -27,6 +28,7 @@ export class ScrollToElement extends Component {
) {
return
}
console.log('scrotoelem')
this.ref.scrollIntoView({
behavior: this.props.behavior
})