🎨 améliore l'affichage et corrige le debounce sur l'input du pourcentage
parent
b6e76ec746
commit
d8ee14a77d
|
@ -3,6 +3,7 @@
|
|||
vertical-align: middle;
|
||||
outline: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
padding: 0;
|
||||
background: none;
|
||||
}
|
||||
|
|
|
@ -2,30 +2,32 @@ import React from 'react'
|
|||
import { debounce } from '../utils'
|
||||
import './PercentageField.css'
|
||||
|
||||
export default class extends React.Component {
|
||||
onChange = this.props.debounce
|
||||
export default class PercentageField extends React.Component {
|
||||
debouncedOnChange = this.props.debounce
|
||||
? debounce(this.props.debounce, this.props.input.onChange)
|
||||
: this.props.input.onChange
|
||||
|
||||
state = {
|
||||
value: this.props.input?.value
|
||||
}
|
||||
onChange(value) {
|
||||
this.setState({ value })
|
||||
this.debouncedOnChange(value)
|
||||
}
|
||||
render() {
|
||||
let {
|
||||
input: { value }
|
||||
} = this.props
|
||||
|
||||
return (
|
||||
<div>
|
||||
<input
|
||||
className="range"
|
||||
onChange={e => this.onChange(e.target.value)}
|
||||
value={value}
|
||||
type="range"
|
||||
value={this.state.value}
|
||||
name="volume"
|
||||
min="0"
|
||||
step="0.1"
|
||||
step="0.05"
|
||||
max="1"
|
||||
/>
|
||||
<span style={{ display: 'inline-block', width: '3em' }}>
|
||||
{value * 100} %
|
||||
{Math.round(this.state.value * 100)} %
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
|
|
|
@ -104,14 +104,16 @@ export default compose(
|
|||
controls={analysis.controls}
|
||||
/>
|
||||
)}
|
||||
<PeriodSwitch />
|
||||
|
||||
{(Array.isArray(objectifs)
|
||||
? [[null, objectifs]]
|
||||
: toPairs(objectifs)
|
||||
).map(([groupName, groupTargets]) => (
|
||||
).map(([groupName, groupTargets], index) => (
|
||||
<>
|
||||
{groupName && <h2>{emoji(groupName)}</h2>}
|
||||
<div style={{ display: 'flex', alignItems: 'end' }}>
|
||||
{groupName && <h2 style={{ flex: 1 }}>{emoji(groupName)}</h2>}
|
||||
{index === 0 && <PeriodSwitch />}
|
||||
</div>
|
||||
<section
|
||||
className="ui__ plain card"
|
||||
style={{
|
||||
|
|
|
@ -19,6 +19,7 @@ questions:
|
|||
blacklist:
|
||||
- entreprise . charges
|
||||
- contrat salarié . avantages en nature . montant
|
||||
- entreprise . rémunération du dirigeant
|
||||
situation:
|
||||
auto entrepreneur: non
|
||||
indépendant: non
|
||||
|
|
|
@ -17,7 +17,7 @@ type OwnProps = {|
|
|||
|
||||
type Props = OwnProps & {
|
||||
tracker: Tracker,
|
||||
location: Location,
|
||||
location: Location
|
||||
}
|
||||
type State = {
|
||||
opened: boolean,
|
||||
|
@ -97,5 +97,5 @@ class SideBar extends React.Component<Props, State> {
|
|||
|
||||
export default (compose(
|
||||
withTracker,
|
||||
withRouter,
|
||||
withRouter
|
||||
)(SideBar): React$ComponentType<OwnProps>)
|
||||
|
|
Loading…
Reference in New Issue