export const UsageCSSStatique = () => {
const { color, text } = useTheme();
return (
<Box display="flex" flexDirection="column" gap={12}>
<Box
display="flex"
flexDirection="row"
gap={8}
style={{
alignItems: 'center',
paddingHorizontal: 12,
paddingVertical: 8,
borderRadius: 8,
backgroundColor: color.light.background['default-grey'],
}}
>
<Box
style={{ width: 8, height: 8, borderRadius: 4, backgroundColor: color.light.background['active-primary'] }}
/>
<Typography style={text['Corps de texte'].SM.Regular}>
Mode actif : CSS pré-compilé — aucune balise <style> injectée
</Typography>
</Box>
<Highlight language="tsx">
{`import '@alveole/theme/dist/default.css';
import { ThemeProvider } from '@alveole/theme';
export default function RootLayout() {
return (
<ThemeProvider staticCSS>
{children}
</ThemeProvider>
);
}`}
</Highlight>
<Box
display="flex"
flexDirection="column"
gap={8}
style={{
paddingHorizontal: 12,
paddingVertical: 10,
borderRadius: 8,
backgroundColor: color.light.background['action-high-error'],
}}
>
<Typography style={{ ...text['Corps de texte'].SM.Medium, color: color.light.text['action-high-error'] }}>
Limitation : incompatible avec color custom
</Typography>
<Typography style={{ ...text['Corps de texte'].SM.Regular, color: color.light.text['action-high-error'] }}>
Si l'app passe un prop `color` au ThemeProvider, les variables overridées ne seront pas injectées. Dans
ce cas, retirer `staticCSS`.
</Typography>
</Box>
<Highlight language="tsx">
{`// ❌ Les overrides color sont ignorés avec staticCSS
<ThemeProvider staticCSS color={{ light: { background: { 'default-grey': '#eee' } } }}>
// ✅ Sans staticCSS, les overrides fonctionnent
<ThemeProvider color={{ light: { background: { 'default-grey': '#eee' } } }}>`}
</Highlight>
</Box>
);
};