import { css, cx } from "emotion"; import * as React from "react"; // @ts-ignore import COLORS from "../../constants/colors"; import { ButtonAtom, CardAtom, IconAtom, TextAtom } from "../../atoms"; interface IProps { className?: any; "data-test"?: any; type?: string; name?: string; min?: number; max?: number; value?: number; description?: string; } class NumberSliderMolecule extends React.PureComponent { constructor(props: any) { super(props); this.state = { value: 0, min: this.props.min, max: this.props.max, }; this.incrementButton = this.incrementButton.bind(this); this.decrementButton = this.decrementButton.bind(this); } public incrementButton() { if (this.state.value < this.state.max) { this.setState({ value: this.state.value + 1, }); } } public decrementButton() { if (this.state.value > this.state.min) { this.setState({ value: this.state.value - 1, }); } } public render() { return (
{this.state.value} {this.props.description}
); } } export { NumberSliderMolecule };