forked from chanzuckerberg/sci-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.ts
35 lines (33 loc) · 1.1 KB
/
style.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Alert } from "@mui/material";
import { styled } from "@mui/material/styles";
import { getColors, getShadows, getSpaces } from "../styles";
export const StyledAlert = styled(Alert)`
${(props) => {
const colors = getColors(props);
const spacings = getSpaces(props);
const shadows = getShadows(props);
const { severity = "success" } = props;
const borderColor = (colors && colors[severity][400]) || "black";
const alertColor = (colors && colors[severity][100]) || "white";
const iconColor = (colors && colors[severity][400]) || "black";
const backgroundColor = colors && colors[severity][100];
return `
background-color: ${backgroundColor};
margin: ${spacings?.m}px 0;
color: ${props.theme.palette.text.primary};
padding: ${spacings?.l}px ${spacings?.l}px
${spacings?.l}px 9px;
background-color: ${alertColor};
&.elevated {
border-left: 5px solid;
box-shadow: ${shadows?.s};
border-color: ${borderColor};
}
.MuiAlert-icon {
path {
fill: ${iconColor};
}
}
`;
}}
`;