Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] Add a sliderStyle property #4617

Merged
merged 1 commit into from
Jul 4, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,10 @@ class Slider extends Component {
* Whether or not the slider is required in a form.
*/
required: PropTypes.bool,
/**
* Override the inline-styles of the inner slider element.
*/
sliderStyle: PropTypes.object,
/**
* The granularity the slider can step through values.
*/
Expand Down Expand Up @@ -690,14 +694,14 @@ class Slider extends Component {
onDragStop, // eslint-disable-line no-unused-vars
onFocus, // eslint-disable-line no-unused-vars
required,
sliderStyle,
step,
style,
...other,
} = this.props;

const {prepareStyles} = this.context.muiTheme;
const styles = getStyles(this.props, this.context, this.state);
const sliderStyles = styles.slider;

let handleStyles = {};
let percent = this.state.percent;
Expand Down Expand Up @@ -763,7 +767,7 @@ class Slider extends Component {
<span>{description}</span>
<span>{error}</span>
<div
style={prepareStyles(sliderStyles)}
style={prepareStyles(Object.assign(styles.slider, sliderStyle))}
onFocus={this.handleFocus}
onBlur={this.handleBlur}
onMouseDown={this.handleMouseDown}
Expand Down