disabled slider implemented

This commit is contained in:
NikolaBorislavovHristov 2019-03-22 19:16:17 +02:00
parent 7f208dedf6
commit 940801c727
2 changed files with 5 additions and 1 deletions

View file

@ -81,7 +81,7 @@ class Slider extends Component {
const trackBeforeSizeProp = this.orientation === 'horizontal' ? 'width' : 'height';
const thumbStart = Math.max(0, Math.min(1, (this.props.value - this.props.minimumValue) / (this.props.maximumValue - this.props.minimumValue)));
return (
<div ref={this.sliderContainerRef} className={classnames(styles['slider-container'], styles[this.orientation], this.props.className)} onMouseDown={this.onStartSliding}>
<div ref={this.sliderContainerRef} className={classnames(styles['slider-container'], styles[this.orientation], { 'disabled': this.props.minimumValue === this.props.maximumValue }, this.props.className)} onMouseDown={this.onStartSliding}>
<div className={styles['track']} />
<div className={styles['track-before']} style={{ [trackBeforeSizeProp]: `calc(100% * ${thumbStart})` }} />
<div className={styles['thumb']} style={{ [thumbStartProp]: `calc(100% * ${thumbStart})` }} />

View file

@ -64,4 +64,8 @@
transform: translateY(50%);
}
}
&:global(.disabled) {
pointer-events: none;
}
}