@@ -72,118 +72,8 @@ Based on what the user needs, read the appropriate documentation files:
7272| ** Migration from older versions** | ` node_modules/@telefonica/mistica/doc/migration-guide.md ` |
7373| ** Lottie animations** | ` node_modules/@telefonica/mistica/doc/lottie.md ` |
7474
75- ## Critical Rules
76-
77- These rules MUST be followed in ALL generated code:
78-
79- 1 . ** NEVER hardcode colors.** Always use ` skinVars.colors.* ` from ` @telefonica/mistica ` . For semi-transparent
80- colors, use ` applyAlpha(skinVars.rawColors.*, alpha) ` .
81-
82- 2 . ** NEVER use raw ` <div> ` for layout or spacing.** Use Mistica layout components:
83-
84- - ` Box ` for padding
85- - ` Stack ` for vertical spacing
86- - ` Inline ` for horizontal spacing
87- - ` ResponsiveLayout ` for page content containers
88- - ` GridLayout ` for column-based layouts
89- - ` Grid ` /` GridItem ` for CSS grid
90-
91- 3 . ** NEVER set font sizes or font families manually.** Use text components: ` Text1 ` -` Text10 ` for body text,
92- ` Title1 ` -` Title4 ` for headings.
93-
94- 4 . ** NEVER set border radius manually.** Use ` skinVars.borderRadii.* ` or Mistica components that handle it
95- (` Boxed ` , cards, etc.).
96-
97- 5 . ** Always wrap the app root** with ` <ThemeContextProvider> ` and import
98- ` @telefonica/mistica/css/mistica.css ` .
99-
100- 6 . ** Always namespace React hooks** : write ` React.useState ` , ` React.useEffect ` , not bare ` useState ` .
101-
102- 7 . ** Add ` 'use client'; ` ** directive when using Next.js app router.
103-
104- 8 . ** Use the ` to ` prop** (not ` href ` ) for client-side navigation after configuring the Link component in
105- theme.
106-
107- 9 . ** Wrap unbounded ` RowList ` ** with ` <NegativeBox> ` when placed inside ` ResponsiveLayout ` .
108-
109- 10 . ** Use ` small ` prop on buttons** inside cards and ` EmptyStateCard ` .
110-
111- 11 . ** Always set ` font-family ` on ` body ` using the correct font for the active skin.** Mistica does NOT inject
112- a font — without it browsers fall back to their default serif font (Times New Roman on desktop). Each skin
113- has a designated font:
114-
115- | Skin | Font family |
116- | ---------------------------- | ------------------- |
117- | ` movistar-new ` _ (preferred)_ | ` 'Movistar Sans' ` |
118- | ` movistar ` _ (legacy)_ | ` 'On Air' ` |
119- | ` o2-new ` , ` o2 ` | ` 'On Air' ` |
120- | ` vivo-new ` _ (preferred)_ | ` 'Vivo Type' ` |
121- | ` vivo ` _ (legacy)_ | ` 'Roboto' ` |
122- | ` telefonica ` , ` tu ` | ` 'Telefonica Sans' ` |
123- | ` blau ` | ` 'Roboto' ` |
124- | ` esimflag ` | ` 'On Air' ` |
125-
126- Read ` node_modules/@telefonica/mistica/doc/fonts.md ` for ` @font-face ` declarations for each font.
127-
128- 12 . ** Always set ` body ` background using ` skinVars.colors.background ` .** Without it the page background won't
129- match the theme, especially in dark mode. Set it inside a component rendered under ` ThemeContextProvider ` :
130-
131- ``` tsx
132- const GlobalStyles = () => <style >{ ` body { background-color: ${skinVars .colors .background }; } ` } </style >;
133- ```
134-
135- 13. ** Do NOT wrap these components in ` ResponsiveLayout ` ** — they already contain one internally :
136- ` HeaderLayout ` , ` MainSectionHeaderLayout ` , ` Hero ` , ` CoverHero ` , ` MasterDetailLayout ` ,
137- ` ButtonFixedFooterLayout ` , ` NavigationBar ` , ` MainNavigationBar ` , ` FunnelNavigationBar ` , ` Tabs ` ,
138- ` SuccessFeedbackScreen ` , ` ErrorFeedbackScreen ` , ` InfoFeedbackScreen ` , ` LoadingScreen ` ,
139- ` BrandLoadingScreen ` . Place them at page level , side by side with ` ResponsiveLayout ` blocks .
140-
141- 14. ** Use carousels only for horizontal content .** ` Carousel ` and ` CenteredCarousel ` are horizontal - scroll
142- components — always place them ** inside ** ` ResponsiveLayout ` . ` Slideshow ` bleeds full - width automatically
143- and should be placed ** outside ** ` ResponsiveLayout ` .
144-
145- ## Quick Reference
146-
147- ### Standard page structure
148-
149- ` ` ` tsx
150- <ThemeContextProvider theme={misticaTheme}>
151- {/* GlobalStyles: set body font (see rule 11) and background (see rule 12) */}
152- <GlobalStyles />
153- {/* These components have their own internal ResponsiveLayout — place them at page level */}
154- <MainNavigationBar sections={[...]} />
155- <HeaderLayout header={<Header title="Page Title" />} />
156- {/* Slideshow goes outside ResponsiveLayout — it bleeds full-width automatically */}
157- <Slideshow items={[...]} />
158- <ResponsiveLayout>
159- <Box paddingY={24}>
160- <Stack space={32}>
161- <Stack space={16}>{/* section elements */}</Stack>
162- {/* Carousel and CenteredCarousel go INSIDE ResponsiveLayout */}
163- <Carousel itemsPerPage={{mobile: 1, tablet: 2, desktop: 3}} items={[...]} />
164- </Stack>
165- </Box>
166- </ResponsiveLayout>
167- </ThemeContextProvider>
168- ` ` `
169-
170- ### Vertical rhythm : 24px container padding , 32px between sections , 16px between elements .
171-
172- ### Card asset pattern
173-
174- ` ` ` tsx
175- <Circle backgroundColor={skinVars.colors.brandLow} size={40}>
176- <IconShopRegular color={skinVars.colors.brand} />
177- </Circle>
178- ` ` `
179-
180- ### Color usage
75+ ## Rules
18176
182- ` ` ` tsx
183- import {skinVars, applyAlpha} from '@telefonica/mistica';
184-
185- skinVars.colors.textPrimary; // text color
186- skinVars.colors.brand; // brand color
187- skinVars.colors.backgroundContainer; // container bg
188- applyAlpha(skinVars.rawColors.brand, 0.5); // semi-transparent
189- ` ` `
77+ Treat ` node_modules/@telefonica/mistica/doc/llms.md ` as the canonical source of truth for critical rules,
78+ page structure, and Mistica best practices. Do not rely on abbreviated rules here when ` llms.md ` is
79+ available.
0 commit comments