Skip to content

Commit a316462

Browse files
committed
feat(v3-uplift): add small alert size variant + dark-mode gradient
MuiAlert: normal icon-box radius 0.5rem -> 0.75rem; add a data-size="small" variant (2rem icon box, 0.8rem icon, 0.75rem/135% text); lift the dark-mode severity gradient tint 3% -> 5% over bgp-2. Dev showcase: add a small-size alert specimen.
1 parent 19e481c commit a316462

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

src/modules/dev/ComponentShowcase/components/FeedbackSection/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,18 @@ export const FeedbackSection = () => (
2121
</Box>
2222
</Specimen>
2323

24+
<Specimen label="Alert — small (data-size)" fullWidth>
25+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 2, width: '100%' }}>
26+
{SEVERITIES.map((severity) => (
27+
<Alert key={severity} severity={severity} data-size="small">
28+
This is a {severity} alert. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
29+
do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
30+
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo.
31+
</Alert>
32+
))}
33+
</Box>
34+
</Specimen>
35+
2436
<Specimen label="Skeleton">
2537
<Skeleton variant="rectangular" width={120} height={20} />
2638
<Skeleton variant="text" width={120} />

src/utils/theme.tsx

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,18 @@ const tertiaryPillStyle = {
100100
},
101101
};
102102

103-
// Alert severity surface: a gradient from the severity colour at 3% (left) fading to bg-2 (right)
104-
// over a bg-2 base, plus the full colour + a 20% tint behind/inside the icon box.
103+
// Alert severity surface: a gradient from the severity colour (left) fading to the base (right),
104+
// plus the full colour + a 20% tint behind/inside the icon box. Light: 3% over bg-2. Dark: the
105+
// tint is lifted to 5% over bgp-2 (#18181B) so it stays visible against the darker canvas.
105106
const alertSeverityStyle = (color: string): CSSObject => ({
106107
background: `linear-gradient(90deg, color-mix(in srgb, ${color} 3%, transparent) 0%, ${figVars['bg-2']} 100%), ${figVars['bg-2']}`,
107108
'.MuiAlert-icon': {
108109
color,
109110
backgroundColor: `color-mix(in srgb, ${color} 20%, transparent)`,
110111
},
112+
...darkScheme({
113+
background: `linear-gradient(90deg, color-mix(in srgb, ${color} 5%, transparent) 0%, ${figVars['bgp-2']} 100%), ${figVars['bgp-2']}`,
114+
}),
111115
});
112116

113117
// Shared box geometry for the custom selection-control icons (checkbox + radio).
@@ -1063,7 +1067,7 @@ export function getThemedComponents(theme: AppTheme) {
10631067
display: 'flex',
10641068
alignItems: 'center',
10651069
justifyContent: 'center',
1066-
borderRadius: '0.5rem',
1070+
borderRadius: '0.75rem',
10671071
boxShadow: `inset 0 0 0 1px ${figVars['border-0']}`,
10681072
opacity: 1,
10691073
'.MuiSvgIcon-root': {
@@ -1102,6 +1106,23 @@ export function getThemedComponents(theme: AppTheme) {
11021106
background: 'transparent',
11031107
},
11041108
},
1109+
// Small size (`data-size="small"`): a tighter 2rem icon box with a 0.8rem icon, and
1110+
// 0.75rem / 135% message text. Everything else (radius, gradient, colours) is inherited.
1111+
'&[data-size="small"]': {
1112+
'.MuiAlert-icon': {
1113+
width: '2rem',
1114+
height: '2rem',
1115+
padding: '0.53125rem 0.5rem 0.46875rem 0.5rem',
1116+
borderRadius: '0.625rem',
1117+
'.MuiSvgIcon-root': {
1118+
fontSize: '0.8rem',
1119+
},
1120+
},
1121+
'.MuiAlert-message': {
1122+
fontSize: '0.75rem',
1123+
lineHeight: '1.0125rem',
1124+
},
1125+
},
11051126
},
11061127
},
11071128
defaultProps: {

0 commit comments

Comments
 (0)