1
0
Fork 0
mirror of https://github.com/betagouv/mon-entreprise synced 2025-02-08 22:15:02 +00:00
mon-entreprise/source/components/ProgressTip.js

50 lines
1.1 KiB
JavaScript
Raw Normal View History

import React, { Component } from 'react'
import { Trans, translate } from 'react-i18next'
2017-12-20 16:21:29 +01:00
import { connect } from 'react-redux'
import { withRouter } from 'react-router'
import './ProgressTip.css'
import { Line } from 'rc-progress'
import { pick } from 'ramda'
@withRouter
@translate()
@connect(
pick(['foldedSteps', 'nextSteps', 'themeColours', 'conversationStarted'])
)
export default class ProgressTip extends Component {
render() {
2018-03-12 10:38:29 +01:00
let {
nextSteps,
foldedSteps,
themeColours: { colour },
conversationStarted
2018-03-12 10:38:29 +01:00
} = this.props,
2017-12-20 16:21:29 +01:00
nbQuestions = nextSteps.length
2018-03-12 10:38:29 +01:00
if (!conversationStarted) return null
return (
2018-03-14 17:10:28 +01:00
nbQuestions != 0 && (
<div className="progressTip">
<Line
style={{
visibility: foldedSteps.length > 0 ? 'visible' : 'hidden'
}}
percent={
100 * foldedSteps.length / (foldedSteps.length + nbQuestions)
}
trailWidth="1"
strokeWidth="2"
strokeColor={colour}
/>
2018-03-14 17:10:28 +01:00
<p>
{nbQuestions === 1
? 'une dernière question !'
: `moins de ${nbQuestions} questions`}
</p>
2018-03-14 17:10:28 +01:00
</div>
)
)
}
}