-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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] Create unstyled version and migrate to emotion & styled-components #22435
Changes from 43 commits
f966e23
4c58672
7fe38a0
0f9b659
6adbc82
0c98292
99499b6
d375e3d
40f7019
4777a55
f891647
2c22ace
5e7f826
940f6d7
3a80cda
27e7286
2946ee1
03a64fa
b05a8e7
a21e199
ff8af15
fa0b76f
8f22840
c448969
7564cc0
4333ed1
79b8a26
0780a15
530b79f
49e50e4
9ec7c65
6f87bc1
4cdb02c
551e2f9
bb0e959
0fbd75e
1da5ffe
6152305
d249d83
47911ac
4f71ad6
95bb696
983f447
bd51f79
5a42c9f
396cee8
a5569b5
61673cd
47c4105
dc7a03e
e39ab3b
b02c56b
1c9e41d
8f2fedd
dc4caee
0cf297b
5c96a89
47d46ef
e6134a2
0eacc0d
8fb4591
d4a6092
cb9bb24
f2fcb52
0048c13
9ba5d01
90cec13
9a0b87c
2479eaa
9ce3a13
8fb98fd
2c4032e
76171a8
858c4b7
f4bba69
ff85f47
fffc2d7
7411958
aa414ff
9ca5f62
669ba1e
fdce96d
deb6e60
b804b36
3d0e31e
03cc79f
37a384f
645edee
9849608
4254cd3
2daf270
3533342
3a3def4
8897bb3
81578de
714b5ba
d681065
ca825c7
2e86e9c
1999fb4
6cd4a5f
c5bec5b
58cda5d
3d232e0
a362702
c9ea84f
f053755
9e77509
a8e1d46
0f8bfc9
a37b64f
cbeb6e9
2f224d6
37f37f1
1636fb8
1d64929
7088108
9cff369
ecda71a
27359e4
836f610
ea3730a
2c80925
3c4701d
5a697bb
1db5ee4
67ede91
34d19ab
f8e347b
bb9fc68
95d8826
f4cd959
c9993b7
24d8ba8
8ee44f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,20 @@ import Typography from '@material-ui/core/Typography'; | |
import Slider from '@material-ui/core/Slider'; | ||
import VolumeDown from '@material-ui/icons/VolumeDown'; | ||
import VolumeUp from '@material-ui/icons/VolumeUp'; | ||
import { ThemeProvider } from '@material-ui/styles'; | ||
import styled from '@emotion/styled'; | ||
|
||
const useStyles = makeStyles({ | ||
root: { | ||
width: 200, | ||
}, | ||
}); | ||
|
||
const CustomSlider = styled(Slider)` | ||
background-color: pink; | ||
border-color: green; | ||
`; | ||
|
||
export default function ContinuousSlider() { | ||
const classes = useStyles(); | ||
const [value, setValue] = React.useState(30); | ||
|
@@ -20,30 +27,63 @@ export default function ContinuousSlider() { | |
setValue(newValue); | ||
}; | ||
|
||
const theme = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These changes are added just for testing, will be reverted before merging There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A reminder to remove the change from the demo. Maybe we could transform that into tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that the components are moved to the lab these are separate examples, but it makes sense to move these in the tests now :)) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added tests, not sure if it makes sense to keep that per component, but at least we have it for now to make sure we don't regress during development |
||
components: { | ||
MuiSlider: { | ||
// @ts-ignore MuiSlider does not support variants, this is added just for testing | ||
variants: [ | ||
{ | ||
props: { color: 'primary', orientation: 'vertical' }, | ||
style: { | ||
backgroundColor: 'green', | ||
border: '3px solid orange', | ||
}, | ||
}, | ||
], | ||
styleOverrides: { | ||
root: { | ||
background: 'red', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
return ( | ||
<div className={classes.root}> | ||
<Typography id="continuous-slider" gutterBottom> | ||
Volume | ||
</Typography> | ||
<Grid container spacing={2}> | ||
<Grid item> | ||
<VolumeDown /> | ||
</Grid> | ||
<Grid item xs> | ||
<Slider | ||
value={value} | ||
onChange={handleChange} | ||
aria-labelledby="continuous-slider" | ||
/> | ||
</Grid> | ||
<Grid item> | ||
<VolumeUp /> | ||
<ThemeProvider theme={theme}> | ||
<div className={classes.root}> | ||
<Typography id="continuous-slider" gutterBottom> | ||
Volume | ||
</Typography> | ||
<Grid container spacing={2}> | ||
<Grid item> | ||
<VolumeDown /> | ||
</Grid> | ||
<Grid item xs> | ||
<Slider | ||
value={value} | ||
onChange={handleChange} | ||
aria-labelledby="continuous-slider" | ||
/> | ||
</Grid> | ||
<Grid item> | ||
<VolumeUp /> | ||
</Grid> | ||
</Grid> | ||
</Grid> | ||
<Typography id="disabled-slider" gutterBottom> | ||
Disabled slider | ||
</Typography> | ||
<Slider disabled defaultValue={30} aria-labelledby="disabled-slider" /> | ||
</div> | ||
<Typography id="disabled-slider" gutterBottom> | ||
Disabled slider | ||
</Typography> | ||
<Slider disabled defaultValue={30} aria-labelledby="disabled-slider" /> | ||
<Typography id="disabled-slider" gutterBottom> | ||
Vertical primary slider | ||
</Typography> | ||
<Slider orientation="vertical" color="primary" defaultValue={30} /> | ||
<CustomSlider | ||
orientation="vertical" | ||
color="primary" | ||
defaultValue={30} | ||
/> | ||
</div> | ||
</ThemeProvider> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make this default, so that initial setup would be zero config, and than do this only for
styled-components
? At this moment at least we can only change this and test styled-components implementation on the docs.