Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | 42x 40x 3x 40x 7x 42x 1x 5x | import { css, cssClass } from '../styled';
import { borderRadius, palette, space, theme } from '../utils';
export const Alert = styleProps => cssClass`
background-color: ${palette(`${styleProps.type}Tint`)(styleProps)};
border-radius: ${borderRadius('default')(styleProps)};
padding: ${space(1, 'major')(styleProps)}rem ${space(2, 'major')(styleProps)}rem;
position: relative;
${styleProps.accent && getAccentAttributes(styleProps)}
${styleProps.isFilled && getFillAttributes(styleProps)}
& {
${theme(styleProps.themeKey, `css.root`)(styleProps)};
}
`;
export const AlertContent = styleProps => cssClass`
${styleProps.isInline &&
css`
display: flex;
& > *:first-child {
margin-right: ${space(1)(styleProps)}rem;
}
`}
& {
${theme(styleProps.themeKey, `css.root`)(styleProps)};
}
`;
export const AlertTitle = styleProps => cssClass`
& {
${theme(styleProps.themeKey, `css.root`)(styleProps)};
}
`;
export const AlertDescription = styleProps => cssClass`
& {
${theme(styleProps.themeKey, `css.root`)(styleProps)};
}
`;
export const AlertIconWrapper = styleProps => cssClass`
line-height: 0.9;
margin-right: ${space(4)(styleProps)}rem;
& {
${theme(styleProps.themeKey, `css.root`)(styleProps)};
}
`;
export const AlertCloseButton = styleProps => cssClass`
&& {
${styleProps.isInline &&
css`
padding: 0;
`}
}
& {
${theme(styleProps.themeKey, `css.root`)(styleProps)};
}
`;
export const getAccentAttributes = styleProps => {
const cssValue = `4px solid ${styleProps.type && palette(styleProps.type)(styleProps)}`;
switch (styleProps.accent) {
case 'top': {
return css`
border-top: ${cssValue};
`;
}
case 'right': {
return css`
border-right: ${cssValue};
`;
}
case 'bottom': {
return css`
border-bottom: ${cssValue};
`;
}
case 'left':
default: {
return css`
border-left: ${cssValue};
`;
}
}
};
export const getFillAttributes = styleProps => css`
background-color: ${palette(styleProps.type)(styleProps)};
color: ${palette(`${styleProps.type}Inverted`)(styleProps)};
`;
|