Merge branch 'main' into claude/reference-site-build
This commit is contained in:
@@ -23,6 +23,10 @@ fifteen ready page sections and ten page templates.
|
||||
New bin `ipal-tokens`: `src/design/tokens.ts` → `src/design/tokens.css` + WCAG contrast check (`--check` for CI).
|
||||
Templates `DESIGN.md` and `tokens.ts` in `ipal-setup/resources`. `ipal-audit` checks the standard.
|
||||
- `fluid.css` / `fluid-wide.css`: `--ipal-fs-xs`, `--ipal-fs-h4`, `--ipal-space-stack`, `--ipal-space-section-sm`.
|
||||
- Design tokens: `data-theme="dark"` / `"light"` switches the tokens on any element (a dark panel, a styleguide), not
|
||||
only on `<html>` (`LIGHT_SELECTOR`, `DARK_SELECTOR`). Inside an inverted section `primary` reads the new
|
||||
`primary-inverse` / `primary-inverse-text` roles (default: the brand primary), and the contrast report checks primary
|
||||
buttons there. The `ipal-form` `formClasses.ts` template uses the token utilities and `buttonClass()`.
|
||||
- **Block library** ([block-library.md](./block-library.md)): `hero`, `textMedia`, `featureGrid`, `cta`, `richText`, `faq`,
|
||||
`contact`, `gallery`, `testimonials`, `stats`, `steps`, `logos`, `team`, `pricing`, `entryList` — Payload block +
|
||||
server component each, `{ en, pl }` panel, accessibility built in, styled only with design-token utilities.
|
||||
|
||||
+3
-2
@@ -906,7 +906,8 @@ Every site uses the same `--ipal-*` token names and Tailwind utilities; only the
|
||||
`rounded-card`, `shadow-sm`, `max-w-container`, `duration-fast ease-out`. **Never** hex, `bg-[#…]`, `var(--color-…)`,
|
||||
or `dark:` for colours (the roles switch with `data-theme` themselves). `dark:` only for non-colour differences.
|
||||
- **Inverted section:** `<Section>` with `settings.background = inverted` → `bg-inverse` + `data-surface="inverse"`;
|
||||
content inside keeps `text-fg` / `text-link` (the scope re-maps them).
|
||||
content inside keeps `text-fg` / `text-link` / `bg-primary` (the scope re-maps them; a dark brand primary needs
|
||||
`primary-inverse` / `primary-inverse-text` in `tokens.ts` — the contrast report says when; default: the brand primary). `data-theme="dark"` on any element = a dark panel.
|
||||
- Fonts via `next/font` with `variable: '--font-family-body'` / `'--font-family-heading'` on `<html>` (not
|
||||
`--font-body`: a `var()` cycle with the `font-body` utility). Max 2 families.
|
||||
- Values a CSS variable can't reach (`next/og`, e-mail, `theme-color`): `resolveColors(tokens)` from `@/design/tokens`.
|
||||
@@ -1054,7 +1055,7 @@ project → **plugin gap**, not a copy.
|
||||
| `next.config` | `buildImagesConfig`, `buildSecurityHeaders` (`csp`), `buildCsp`, `buildCspHeaders`, `buildAdminCsp` / `buildAdminCspHeaders`, `buildUploadSecurityHeaders`, `withSecurityConfig` (hides `X-Powered-By`) | storage.md, security.md |
|
||||
| CSP reports, nonces | `createCspReportRoute` (`parseCspReports`, type `CspViolation`), `createProxy({ csp })` + `<SiteProviders nonce>` (dynamic pages only), `createCspNonce`, `CSP_NONCE_HEADER`, `buildReportingEndpoints`, `cspHeaderKey`, `DEFAULT_CSP_REPORT_GROUP`; types `BuildAdminCspArgs`, `CspDirective`, `CspSources`, `CreateCspReportRouteArgs`, `WithSecurityConfigOptions` | security.md |
|
||||
| Fluid typography and spacing | `fluid.css` / `fluid-wide.css` (`--ipal-*` variables); your own sizes: `fluidClamp`, `FLUID_SCALE`, `FLUID_RANGES` | design-tokens.md |
|
||||
| Brand colours, fonts, radii, motion, dark mode | `tokens.css` + `tailwind.css`, `src/design/tokens.ts` (`defineTokens`, types `TokensInput`, `ColorInput`, `ColorRole`), `pnpm exec ipal-tokens` (`--check`, `--report`, `--warn-only`); building blocks `tokensToCss`, `defaultTokensCss`, `contrastReport` (`ContrastRow`), `contrastRatio`, `parseColor`, `resolveColors`, `IPAL_TOKENS`, `ipalVar`, `IpalTokenName`, `IPAL_BREAKPOINTS`, `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, `RemValue`, `FluidRange` | design-tokens.md |
|
||||
| Brand colours, fonts, radii, motion, dark mode | `tokens.css` + `tailwind.css`, `src/design/tokens.ts` (`defineTokens`, types `TokensInput`, `ColorInput`, `ColorRole`), `pnpm exec ipal-tokens` (`--check`, `--report`, `--warn-only`); building blocks `tokensToCss`, `defaultTokensCss`, `contrastReport` (`ContrastRow`), `contrastRatio`, `parseColor`, `resolveColors`, `IPAL_TOKENS`, `ipalVar`, `IpalTokenName`, `IPAL_BREAKPOINTS`, `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `LIGHT_SELECTOR`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, `RemValue`, `FluidRange` | design-tokens.md |
|
||||
| Accessibility widget CSS | `@intecion/ipal-kit/a11y.css` (works through the tokens) | accessibility.md |
|
||||
|
||||
**Consent, analytics, operations**
|
||||
|
||||
@@ -1,29 +1,36 @@
|
||||
// src/components/forms/formClasses.ts — the ONLY place forms are styled. Every
|
||||
// panel form (RenderForm / BuilderForm) uses it. Values = the project's design
|
||||
// tokens (DESIGN.md); the plugin ships no styles. Delete keys you don't need.
|
||||
// panel form (RenderForm / BuilderForm) uses it. Design-token utilities only
|
||||
// (node_modules/@intecion/ipal-kit/docs/design-tokens.md): a brand changes
|
||||
// src/design/tokens.ts, never this file. Delete keys you don't need.
|
||||
import type { BuilderFormClassNames } from '@intecion/ipal-kit/client'
|
||||
import { buttonClass } from '@intecion/ipal-kit/blocks/rsc'
|
||||
|
||||
const control =
|
||||
'w-full rounded-control border border-border-strong bg-surface px-3 py-2 text-fg placeholder:text-fg-muted ' +
|
||||
'transition-colors duration-fast ease-out focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus ' +
|
||||
'aria-invalid:border-danger'
|
||||
|
||||
export const formClasses: BuilderFormClassNames = {
|
||||
form: 'grid gap-6',
|
||||
progress: 'text-sm text-muted', // "Step 1 of 3"
|
||||
progress: 'text-sm text-fg-muted', // "Step 1 of 3"
|
||||
step: 'grid gap-4',
|
||||
stepTitle: 'text-h3 font-semibold',
|
||||
stepDescription: 'text-muted',
|
||||
stepTitle: 'text-h4',
|
||||
stepDescription: 'text-fg-muted',
|
||||
fields: 'grid grid-cols-12 gap-4',
|
||||
field: 'col-span-12',
|
||||
fieldHalf: 'md:col-span-6', // width ≤ 50 in the panel
|
||||
label: 'mb-1 block font-medium',
|
||||
input: 'w-full rounded-md border border-border px-3 py-2',
|
||||
textarea: 'w-full rounded-md border border-border px-3 py-2',
|
||||
select: 'w-full rounded-md border border-border px-3 py-2',
|
||||
label: 'mb-1 block font-medium text-fg-strong',
|
||||
input: control,
|
||||
textarea: control,
|
||||
select: control,
|
||||
checkboxLabel: 'flex items-start gap-2',
|
||||
choices: 'grid gap-2', // radio / checkbox group <fieldset>
|
||||
legend: 'mb-1 font-medium',
|
||||
legend: 'mb-1 font-medium text-fg-strong',
|
||||
choice: 'flex items-center gap-2',
|
||||
error: 'mt-1 text-sm text-danger',
|
||||
formError: 'text-danger',
|
||||
actions: 'flex gap-3',
|
||||
back: 'btn btn-secondary', // same classes as Button.tsx variants
|
||||
submit: 'btn btn-primary',
|
||||
success: 'rounded-md bg-surface p-6',
|
||||
formError: 'rounded-control bg-danger-surface p-4 text-danger',
|
||||
actions: 'flex flex-wrap gap-3',
|
||||
back: buttonClass('secondary'), // the same looks as the section buttons
|
||||
submit: buttonClass('primary'),
|
||||
success: 'rounded-card bg-success-surface p-6 text-success',
|
||||
}
|
||||
|
||||
@@ -759,7 +759,7 @@ CSS: `@intecion/ipal-kit/tokens.css` (neutral `--ipal-*` defaults, light/dark, `
|
||||
| `ipalVar(name, fallback?)` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | `var(--ipal-<name>[, fallback])`. |
|
||||
| `IPAL_BREAKPOINTS` | `@intecion/ipal-kit/tokens`, `@intecion/ipal-kit` | `{ sm: 40, md: 48, lg: 64, xl: 80, '2xl': 96 }` (rem) — for `sizes=` / `matchMedia`. |
|
||||
| `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES` | `@intecion/ipal-kit/tokens` | The catalogue: colour defaults per theme, theme-independent defaults, fluid names, inverse re-map, the old `-dark` twins. |
|
||||
| `DARK_SELECTOR`, `INVERSE_SELECTOR` | `@intecion/ipal-kit/tokens` | `:root[data-theme="dark"]`, `[data-surface="inverse"]`. |
|
||||
| `LIGHT_SELECTOR`, `DARK_SELECTOR`, `INVERSE_SELECTOR` | `@intecion/ipal-kit/tokens` | `:root, [data-theme="light"]`, `:root[data-theme="dark"], [data-theme="dark"]` (a theme on any element), `[data-surface="inverse"]`. |
|
||||
|
||||
**Types:** `TokensInput`, `IpalTokenName` (root, `/tokens`), `ColorInput`, `ColorRole`, `ContrastRow`, `FluidRange`, `RemValue` (`/tokens`).
|
||||
|
||||
|
||||
+12
-7
@@ -91,13 +91,13 @@ block has them) → `variant` (sidebar) → `settings` (sidebar: anchor, backgro
|
||||
|
||||
| Slug (builder) | Panel name | Own fields | Variants | Accessibility |
|
||||
|---|---|---|---|---|
|
||||
| `hero` (`buildHeroBlock`) | Hero / `Sekcja główna` | `media` (image or video), `poster` | `split`, `background`, `centered`, `page` | the first section's heading is the page `h1`; its image is the LCP image (eager, high priority); a background image is decorative (`alt=""`) under a scrim |
|
||||
| `hero` (`buildHeroBlock`) | Hero / `Sekcja główna` | `media` (image or video), `poster` | `split`, `background`, `centered`, `page` | the first section's heading is the page `h1`; its image is the LCP image (eager, high priority); a background image is decorative (`alt=""`) under a full `bg-overlay` scrim (raise `--ipal-overlay` for very light photos) |
|
||||
| `textMedia` (`buildTextMediaBlock`) | Text and image | `content` (rich text), `media` | `mediaRight`, `mediaLeft` | reading order = text first on every screen |
|
||||
| `featureGrid` (`buildFeatureGridBlock`) | Feature grid | `items[]`: `icon` (with `icons`), `media`, `heading`, `text`, `link`; `columns` | `cards`, `list`, `numbered` | a linked feature: its heading is the link and covers the card; a dead link leaves plain text |
|
||||
| `gallery` (`buildGalleryBlock`) | Gallery | `items[]`: `media`, `caption`; `columns` | `grid`, `masonry` | each image a `LightboxTrigger` (keyboard, focus return, labels from Form messages); captions in `<figcaption>` |
|
||||
| `faq` (`buildFaqBlock`) | FAQ | `items[]`: `question`, `answer` | `single`, `twoColumn` | native `<details>`/`<summary>`, works without script |
|
||||
| `cta` (`buildCtaBlock`) | Call to action | `media` | `band`, `card`, `split` | renders nothing without a heading and buttons |
|
||||
| `contact` (`buildContactBlock`) | Contact | `form` (relation), `content` | `formWithDetails`, `formOnly` | `RenderForm` (labels, errors, consent); details as `<dl>` |
|
||||
| `contact` (`buildContactBlock`) | Contact | `form` (relation), `content` | `formWithDetails`, `formOnly` | `RenderForm` (labels, errors, consent); details as `<dl>`; the spam check widget turns dark in an inverted section |
|
||||
| `team` (`buildTeamBlock`) | Team | `items[]`: `media`, `heading` (name), `text` (role), `bio`, `link` | `grid`, `list` | the name is the profile link |
|
||||
| `pricing` (`buildPricingBlock`) | Pricing | `items[]`: `heading`, `price`, `period`, `text`, `features[]`, `highlighted`, `link`; `highlightLabel`, `note` | — | the highlighted plan carries a text label, not only a colour |
|
||||
| `logos` (`buildLogosBlock`) | Logos | `items[]`: `media`, `heading` (name), `link` | `row`, `grid` | the name is the alt text when the image has none; no marquee |
|
||||
@@ -105,7 +105,7 @@ block has them) → `variant` (sidebar) → `settings` (sidebar: anchor, backgro
|
||||
| `stats` (`buildStatsBlock`) | Key figures / `Liczby` | `items[]`: `value`, `heading` (label), `text` | `row`, `cards` | a `<dl>`; static (no count-up animation) |
|
||||
| `richText` (`buildRichTextBlock`) | Text | `content`, `tableOfContents` | `narrow`, `wide` | heading anchors + table of contents (`aria-current` on the section being read) |
|
||||
| `steps` (`buildStepsBlock`) | Steps | `items[]`: `heading`, `text`, `media` | `numbered`, `timeline` | an `<ol>`; the number read as "Step 1" |
|
||||
| `entryList` (`buildEntryListBlock`) | Entry list | `collection`, `mode` (latest / chosen), `limit`, `entries` | `cards`, `list` | each title links to its entry and covers the card; dates in `<time>` |
|
||||
| `entryList` (`buildEntryListBlock`) | Entry list | `entryCollection`, `mode` (latest / chosen), `limit`, `entries` | `cards`, `list` | each title links to its entry and covers the card; dates in `<time>` |
|
||||
|
||||
**Rules every block meets:** one `<section>` with `aria-labelledby` its heading and `data-ipal-block`; `h1` only in the
|
||||
first block (`isFirst` from `createPageRoute`), `h2` otherwise, items `h3`; images through `Media` (alt from the media
|
||||
@@ -140,6 +140,9 @@ the components come from `createBlockRegistry({ icons })`), `testimonials: { col
|
||||
collection as well), `entryList: { collections: [{ label: { en: 'Projects', pl: 'Realizacje' }, value: 'projects' }] }`
|
||||
(default posts), `contact: { formsCollection }` (default `forms`).
|
||||
|
||||
**Field names** never use a path name Mongoose reserves (`collection`, `schema`, `errors`, `get`, `set`…) — MongoDB is
|
||||
on every live site and warns on each start (a test enforces it for the library; keep to it in your own `fields`).
|
||||
|
||||
**Same panel for the project's own blocks:** `buildItemsField({ fields, labels, rowLabelField, maxRows })`,
|
||||
`buildMediaField()`, `buildVariantField({ options })`, `buildIconField({ names })`, `buildContentField()`,
|
||||
`columnsField()` (values `COLUMNS`: `two`, `three`, `four`), `adminText(en, pl)`, `variantOption(value, en, pl)`, and
|
||||
@@ -167,7 +170,9 @@ plugin's components. `content` needs `resolveLink`; `getEntries` (entry list), `
|
||||
|
||||
**UI primitives** (`/blocks/rsc`), each styled once with token utilities: `Section` (anchor, background,
|
||||
`data-surface` for the inverted token scope, spacing, `Container`), `SectionHeader` (eyebrow, `h1`/`h2`, intro),
|
||||
`Media` (image or video; `next/image` when passed), `CMSLink` (a panel link → `Anchor`, with `buttonClass`),
|
||||
`Media` (image or video; `next/image` when passed; `resource` takes any media object, so generated `Media` types fit),
|
||||
`CMSLink` (a panel link → `Anchor`, with `buttonClass`; a link that wraps something — a logo, a card — and leads nowhere
|
||||
keeps its content without a link, so an empty link group never hides it),
|
||||
`buttonClass` / `BUTTON_CLASSES` (button looks by appearance), `Container` / `CONTAINER_WIDTHS`, `Card` / `CARD_CLASS` /
|
||||
`CARD_INTERACTIVE_CLASS`. Helpers for the project's own blocks: `Buttons` (a block's button row), `headingId(block)`
|
||||
(the heading id for `aria-labelledby`), `TitleLink` (a card title that links when its link resolves), `GRID_COLUMNS`,
|
||||
@@ -212,9 +217,9 @@ overwrites an existing file (`--dest`, `--dry-run`).
|
||||
| `service({ form? })` | hero · textMedia · featureGrid (list) · gallery · faq · contact | — |
|
||||
| `contact({ form })` | hero (page) · contact · faq | — |
|
||||
| `blogIndex()` | hero (page) · cta — the entries come from the archive view (docs/content.md) | `postsArchive` |
|
||||
| `post()` | richText (table of contents) · entryList · cta — for a posts collection with a `layout` field | — |
|
||||
| `legal('privacyPolicy' \| 'termsOfService')` | hero (page) · richText (table of contents) — structure only; the wording comes from the client | `privacyPolicy`, `termsOfService` |
|
||||
| `cookiePolicy()` | hero (page) · richText | `cookiePolicy` |
|
||||
| `post({ title })` | hero (page, the post title as `h1`) · richText (table of contents) · entryList · cta — for a posts collection with a `layout` field | — |
|
||||
| `legal('privacyPolicy' \| 'termsOfService')` | hero (page) · richText (table of contents), `noindex: true` — structure only; the wording comes from the client | `privacyPolicy`, `termsOfService` |
|
||||
| `cookiePolicy()` | hero (page) · richText, `noindex: true` | `cookiePolicy` |
|
||||
| `notFound()` | hero (page) with a button home | `notFound` |
|
||||
|
||||
```ts
|
||||
|
||||
+18
-7
@@ -11,7 +11,7 @@ Everything here is opt-in. A site that imports none of it looks exactly as befor
|
||||
|
||||
| Export | What it is |
|
||||
|---|---|
|
||||
| `@intecion/ipal-kit/tokens.css` | neutral defaults for every token: light on `:root`, dark on `:root[data-theme="dark"]`, the inverse scope, reduced motion |
|
||||
| `@intecion/ipal-kit/tokens.css` | neutral defaults for every token: light on `:root` / `[data-theme="light"]`, dark on `[data-theme="dark"]` (any element), the inverse scope, reduced motion |
|
||||
| `@intecion/ipal-kit/tailwind.css` | Tailwind 4 preset: `@theme inline` map (utilities below), `dark:` on `data-theme`, `duration-*` / `z-*` utilities, a small base layer, the theme-switch transition |
|
||||
| `@intecion/ipal-kit/fluid-wide.css` / `fluid.css` | the type and space scale (`--ipal-fs-*`, `--ipal-space-*`, containers, height helpers): grows to 1920 px / 1280 px |
|
||||
| `@intecion/ipal-kit/a11y.css` | optional CSS for the accessibility widget's attributes, working through the tokens (accessibility.md) |
|
||||
@@ -88,7 +88,7 @@ Dark mode: `<SiteProviders theme>` (theme.md). Nothing else is needed: the roles
|
||||
| `secondary` · `secondary-hover` · `secondary-text` | second button (default: neutral strong) | `bg-secondary` · `text-on-secondary` |
|
||||
| `accent` · `accent-text` | highlight, badge, rating stars (default: primary) | `bg-accent` · `text-accent` · `text-on-accent` |
|
||||
| `link` · `link-hover` | links in running text | `text-link` · `hover:text-link-hover` |
|
||||
| `link-inverse` · `focus-inverse` | link and focus ring inside an inverted section | (read through the inverse scope) |
|
||||
| `link-inverse` · `focus-inverse` · `primary-inverse` · `primary-inverse-text` | link, focus ring and primary button inside an inverted section | (read through the inverse scope) |
|
||||
| `hover` | neutral hover (ghost button, row) | `bg-hover` |
|
||||
| `focus` | focus ring | `outline-focus` · `ring-focus` |
|
||||
| `overlay` | scrim, hero image overlay | `bg-overlay` · `from-overlay` |
|
||||
@@ -113,13 +113,24 @@ standard). Any CSS colour works.
|
||||
|
||||
A project may *add* a breakpoint (`--breakpoint-xs`) as a deviation recorded in `DESIGN.md`. It never moves an existing one.
|
||||
|
||||
### Themes on any element
|
||||
|
||||
`data-theme="dark"` / `"light"` switches the colour roles on any element, not only `<html>`: a dark panel on a light
|
||||
page, or a styleguide showing both themes side by side (`<div data-theme="dark" className="bg-bg">…</div>`). The
|
||||
preset's base layer gives such a panel its text colour; give it a background yourself (`bg-bg` or `bg-surface`). The
|
||||
Tailwind `dark:` variant follows the nearest `data-theme`.
|
||||
|
||||
### Inverted sections
|
||||
|
||||
`<Section>` with `settings.background = inverted` renders `bg-inverse` and `data-surface="inverse"`. Inside that
|
||||
scope, `text`, `text-strong`, `text-muted`, `border(-strong)`, `surface`, `hover`, `link` and `focus` are re-mapped
|
||||
for the inverse surface, and `color-scheme` flips. Cards, rich text, links and focus rings need no inverse variants:
|
||||
they keep `text-fg`, `text-link`, `border-border`. `primary` / `accent` are not re-mapped. The contrast report warns
|
||||
when `primary` on `surface-inverse` is below 3:1.
|
||||
scope, `text`, `text-strong`, `text-muted`, `border(-strong)`, `surface`, `hover`, `link`, `focus` and `primary`
|
||||
(+ `primary-hover`, `primary-text`) are re-mapped for the inverse surface, and `color-scheme` flips. Cards, rich text,
|
||||
links, focus rings and primary buttons need no inverse variants: they keep `text-fg`, `text-link`, `border-border`,
|
||||
`bg-primary text-on-primary`. `primary` inside reads **`primary-inverse`** / **`primary-inverse-text`** (default: the
|
||||
brand primary). A dark brand colour vanishes on a dark inverse surface: the contrast report warns (`primary on
|
||||
surface-inverse` below 3:1, inverse scope), so set a lighter one, per theme: `color: { light: { 'primary-inverse':
|
||||
'oklch(0.85 0.1 150)', 'primary-inverse-text': 'oklch(0.2 0.05 150)' } }`. `accent` is not re-mapped. Put
|
||||
`data-surface` and `data-theme` on different elements.
|
||||
|
||||
### Legacy `-dark` names
|
||||
|
||||
@@ -154,7 +165,7 @@ and focus rings (3:1).
|
||||
| `fluidClamp(min, max, range)` | the fluid.css `clamp()` for your own sizes; `FLUID_SCALE`, `FLUID_RANGES`, type `FluidRange`, `RemValue` |
|
||||
| `IPAL_TOKENS`, `ipalVar(name, fallback?)` | `var(--ipal-…)` strings for inline styles, charts, a styleguide page (type `IpalTokenName`) |
|
||||
| `IPAL_BREAKPOINTS` | breakpoints in rem |
|
||||
| `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, type `ColorRole` | the catalogue itself |
|
||||
| `COLOR_DEFAULTS`, `STATIC_DEFAULTS`, `FLUID_TOKENS`, `INVERSE_SCOPE`, `LEGACY_DARK_ROLES`, `LIGHT_SELECTOR`, `DARK_SELECTOR`, `INVERSE_SELECTOR`, type `ColorRole` | the catalogue itself |
|
||||
|
||||
Values that CSS variables can't reach (`next/og` images, e-mail templates, `<meta name="theme-color">`): import `tokens`
|
||||
from `@/design/tokens` and read `resolveColors(tokens).light.primary`.
|
||||
|
||||
@@ -68,6 +68,13 @@ import { ThemeSwitcher } from '@intecion/ipal-kit/client'
|
||||
/>
|
||||
```
|
||||
|
||||
Both icons render: the default is a two-option toggle with the active one highlighted (the `classNames` above).
|
||||
For one icon that changes with the theme (sun in light, moon in dark), hide the other with the `dark:` variant:
|
||||
|
||||
```tsx
|
||||
<ThemeSwitcher label={themeLabel} classNames={{ light: 'block dark:hidden', dark: 'hidden dark:block' }} />
|
||||
```
|
||||
|
||||
`<button role="switch" aria-checked>` (checked = dark). Which button looks active is decided by CSS
|
||||
from the attribute on `<html>` (`dark:`), not React state — nothing jumps after hydration.
|
||||
Hooks for styling: `data-ipal="theme-switch"`, `data-ipal-theme-icon="light|dark"`.
|
||||
|
||||
Reference in New Issue
Block a user