Skip to content

Commit

Permalink
slider thumb icon feature
Browse files Browse the repository at this point in the history
  • Loading branch information
adeelibr committed Aug 20, 2018
1 parent eae16a1 commit a07aa25
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/src/pages/lab/slider/CustomIconSlider.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class CustomIconSlider extends React.Component {

return (
<div className={classes.root}>
<Typography id="label">Slider Simple</Typography>
<Slider value={value} aria-labelledby="label" onChange={this.handleChange} />
<Typography id="label">Slider Image</Typography>
<Slider
value={value}
aria-labelledby="label"
onChange={this.handleChange}
thumb={<img src="/static/images/cards/live-from-space.jpg" alt="" />}
/>
<Typography id="label">Slider Simple</Typography>
<Slider value={value} aria-labelledby="label" onChange={this.handleChange} />
<Typography id="label">Slider Icon</Typography>
<Slider
value={value}
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/lab/slider/slider.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ Sliders reflect the current state of the settings they control.

## Custom Icon slider

If you want to have a custom thumb icon.
If you want to have a custom thumb icon image or svg.

{{"demo": "pages/lab/slider/CustomIconSlider.js"}}
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,15 +435,15 @@ class Slider extends React.Component {
const inlineTrackAfterStyles = { [trackProperty]: this.calculateTrackAfterStyles(percent) };
const inlineThumbStyles = { [thumbProperty]: `${percent}%` };

/** Start Thumbnail Icon Logic Here */
/** Start Thumbnail-Icon Logic Here */
const withIcon = !!Thumb;
const Thumbnail = withIcon
? React.cloneElement(Thumb, {
...Thumb.props,
className: `${classes.thumbIcon} ${Thumb.props.className || ''}`,
})
: null;
/** End Thumbnail Icon Logic Here */
/** End Thumbnail-Icon Logic Here */

const thumbClasses = classNames(
classes.thumb,
Expand Down
12 changes: 6 additions & 6 deletions pages/lab/slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/lab/slider/VerticalSlider'), 'utf8')
`,
},
'pages/lab/slider/ReverseSlider.js': {
js: require('docs/src/pages/lab/slider/ReverseSlider').default,
'pages/lab/slider/CustomIconSlider.js': {
js: require('docs/src/pages/lab/slider/CustomIconSlider').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/lab/slider/ReverseSlider'), 'utf8')
.readFileSync(require.resolve('docs/src/pages/lab/slider/CustomIconSlider'), 'utf8')
`,
},
'pages/lab/slider/CustomIconSlider.js': {
js: require('docs/src/pages/lab/slider/CustomIconSlider').default,
'pages/lab/slider/ReverseSlider.js': {
js: require('docs/src/pages/lab/slider/ReverseSlider').default,
raw: preval`
module.exports = require('fs')
.readFileSync(require.resolve('docs/src/pages/lab/slider/CustomIconSlider'), 'utf8')
.readFileSync(require.resolve('docs/src/pages/lab/slider/ReverseSlider'), 'utf8')
`,
},
}}
Expand Down

0 comments on commit a07aa25

Please sign in to comment.