Fix checkbox styles
This commit is contained in:
parent
f5fb676966
commit
3968651457
2 changed files with 27 additions and 9 deletions
|
@ -7,6 +7,7 @@ import {
|
||||||
withStyles,
|
withStyles,
|
||||||
WithStyles
|
WithStyles
|
||||||
} from "@material-ui/core/styles";
|
} from "@material-ui/core/styles";
|
||||||
|
import { fade } from "@material-ui/core/styles/colorManipulator";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
@ -29,7 +30,11 @@ const styles = (theme: Theme) =>
|
||||||
box: {
|
box: {
|
||||||
"&$checked": {
|
"&$checked": {
|
||||||
"&:before": {
|
"&:before": {
|
||||||
background: theme.palette.primary.main
|
background: theme.palette.primary.main,
|
||||||
|
content: '"\\2713"',
|
||||||
|
color: theme.palette.common.white,
|
||||||
|
fontWeight: "bold",
|
||||||
|
textAlign: "center"
|
||||||
},
|
},
|
||||||
borderColor: theme.palette.primary.main
|
borderColor: theme.palette.primary.main
|
||||||
},
|
},
|
||||||
|
@ -47,13 +52,14 @@ const styles = (theme: Theme) =>
|
||||||
"&:before": {
|
"&:before": {
|
||||||
background: "rgba(0, 0, 0, 0)",
|
background: "rgba(0, 0, 0, 0)",
|
||||||
content: '""',
|
content: '""',
|
||||||
height: 8,
|
height: 14,
|
||||||
left: 2,
|
left: -1,
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
top: 2,
|
top: -1,
|
||||||
transition: theme.transitions.duration.short + "ms",
|
transition: theme.transitions.duration.short + "ms",
|
||||||
width: 8
|
width: 14
|
||||||
},
|
},
|
||||||
|
|
||||||
WebkitAppearance: "none",
|
WebkitAppearance: "none",
|
||||||
border: `1px solid ${theme.palette.grey[500]}`,
|
border: `1px solid ${theme.palette.grey[500]}`,
|
||||||
boxSizing: "border-box",
|
boxSizing: "border-box",
|
||||||
|
@ -72,9 +78,13 @@ const styles = (theme: Theme) =>
|
||||||
borderRadius: "100%",
|
borderRadius: "100%",
|
||||||
cursor: "pointer",
|
cursor: "pointer",
|
||||||
display: "flex",
|
display: "flex",
|
||||||
height: 48,
|
height: 30,
|
||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
width: 48
|
width: 30,
|
||||||
|
margin: 9,
|
||||||
|
"&:hover": {
|
||||||
|
background: fade(theme.palette.primary.main, 0.1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const Checkbox = withStyles(styles, { name: "Checkbox" })(
|
const Checkbox = withStyles(styles, { name: "Checkbox" })(
|
||||||
|
|
|
@ -35,12 +35,20 @@ const styles = (theme: Theme) =>
|
||||||
padding: 0
|
padding: 0
|
||||||
},
|
},
|
||||||
checkboxPartialSelect: {
|
checkboxPartialSelect: {
|
||||||
|
"& input": {
|
||||||
|
"&:before": {
|
||||||
|
background: [theme.palette.common.white, "!important"] as any,
|
||||||
|
border: `solid 1px ${theme.palette.primary.main}`,
|
||||||
|
content: "''"
|
||||||
|
},
|
||||||
|
background: theme.palette.common.white
|
||||||
|
},
|
||||||
"&:after": {
|
"&:after": {
|
||||||
background: theme.palette.common.white,
|
background: theme.palette.primary.main,
|
||||||
content: "''",
|
content: "''",
|
||||||
height: 2,
|
height: 2,
|
||||||
position: "absolute",
|
position: "absolute",
|
||||||
width: 4
|
width: 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
checkboxSelected: {
|
checkboxSelected: {
|
||||||
|
|
Loading…
Reference in a new issue