import React from 'react'; import PropTypes from 'prop-types'; import Slider, { Range } from 'rc-slider'; import colors from './../../../colors'; import { Form, FormGroup, Card, CardBody, CardTitle, Label, Input, Button, Row, Col, Container } from './../../../components'; import { HeaderMain } from "../../components/HeaderMain"; import { HeaderDemo } from "../../components/HeaderDemo"; import classes from './Sliders.scss'; const marks = { '-10': '-10°C', 0: 0°C, 26: '26°C', 37: '37°C', 50: '50°C', 100: { style: { color: colors['danger'], }, label: 100°C, }, } class CustomizedRange extends React.Component { constructor(props) { super(props); this.state = { lowerBound: 20, upperBound: 40, value: [20, 40] }; } onLowerBoundChange(e) { this.setState({ lowerBound: +e.target.value }); } onUpperBoundChange(e) { this.setState({ upperBound: +e.target.value }); } onSliderChange(value) { this.setState({ value, }); } handleApply() { const { lowerBound, upperBound } = this.state; this.setState({ value: [lowerBound, upperBound] }); } render() { return (
); } } class DynamicBounds extends React.Component { static propTypes = { children: PropTypes.node.isRequired } constructor(props) { super(props); this.state = { min: 0, max: 100, }; } onMinChange(e) { this.setState({ min: +e.target.value || 0, }); } onMaxChange(e) { this.setState({ max: +e.target.value || 100, }); } render() { const { children } = this.props; const updatedChild = React.cloneElement(React.Children.only(children), { min: this.state.min, max: this.state.max }); return (
{ updatedChild }
); } } class ControlledRange extends React.Component { constructor(props) { super(props); this.state = { value: [20, 40, 60, 80], }; } handleChange = (value) => { this.setState({ value, }); } render() { return ( ); } } class CustomizedSlider extends React.Component { constructor() { super(); this.state = { value: 50 } } onSliderChange(value) { this.setState({ value }); } render() { return( ) } } export class Sliders extends React.Component { render() { return ( { /* START Header 1 */} See 6 examples below: )} /> { /* END Header 1 */} { /* START Card Example */}

Slider with marks, step=null

Slider with marks, included=false

Slider with marks and steps

Slider with marks and steps, included=false

Range with marks

Range with marks and steps

{ /* END Card Example */} { /* START Header 2 */} See 8 examples below: )} /> { /* END Header 2 */} { /* START Card Example */}

Basic Range,allowCross=false

Basic Range,disabled

Basic Range,step=20

Basic Range,step=20, dots

Controlled Range

Multi Range

Customized Range

Range with dynamic max min

{ /* END Card Example */} { /* START Header 3 */} See 7 examples below: )} /> { /* END Header 3 */} { /* START Card Example */}

Basic Slider

Basic Slider, disabled

Basic Slider,step=20

Basic Slider,step=20, dots

Controlled Slider

Customized Slider

Slider with dynamic min, max

{ /* START Header 4 */} See 6 examples below: )} /> { /* END Header 4 */} { /* START Card Example */}

Slider with marks, step=null

Slider with marks and steps

Slider with marks, included=false

Slider with marks and steps, included=false

Range with marks

Range with marks and steps

{ /* END Card Example */}
); } }