Adds design tokens, text styles, and LinkButton recipe to the Chakra theme
Brings the palette and values from the static design's :root into the theme: paper/ink/accent/line/sand colors, eyebrow font size, caps letter spacing, gutter spacing, smooth easing, interaction/fade durations, a scrim gradient, and header sizes (66px, 92px from lg; 68px when sticky). Switches bg/fg from the placeholder colors to paper/ink, adds eyebrow and display text styles, sets headings to weight 400, and adds a linkButton recipe (outline, accent, light) with a LinkButton component wrapping the router Link. NavLink now uses the eyebrow text style and motion tokens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { chakra, useRecipe, type RecipeVariantProps } from '@chakra-ui/react';
|
||||
import { Link } from '@tanstack/react-router';
|
||||
import type linkButtonRecipe from '../recipes/linkButton';
|
||||
|
||||
const ChakraLink = chakra(Link);
|
||||
|
||||
type LinkButtonProps = React.ComponentProps<typeof ChakraLink> &
|
||||
RecipeVariantProps<typeof linkButtonRecipe>;
|
||||
|
||||
// Router-link in de knopstijl uit het design. Styling komt uit de
|
||||
// `linkButton`-recipe in het thema.
|
||||
export default function LinkButton(props: LinkButtonProps) {
|
||||
const recipe = useRecipe({ key: 'linkButton' });
|
||||
const [variantProps, rest] = recipe.splitVariantProps(props);
|
||||
|
||||
return <ChakraLink css={recipe(variantProps)} {...rest} />;
|
||||
}
|
||||
@@ -8,10 +8,8 @@ type NavLinkProps = React.ComponentProps<typeof ChakraLink>;
|
||||
export default function NavLink({ children, ...props }: NavLinkProps) {
|
||||
return (
|
||||
<ChakraLink
|
||||
textTransform="uppercase"
|
||||
textStyle="eyebrow"
|
||||
fontWeight="300"
|
||||
fontSize="0.72rem"
|
||||
letterSpacing="0.22em"
|
||||
position="relative"
|
||||
display="inline-block"
|
||||
py="2"
|
||||
@@ -27,7 +25,9 @@ export default function NavLink({ children, ...props }: NavLinkProps) {
|
||||
bg: 'currentColor',
|
||||
transform: 'scaleX(0)',
|
||||
transformOrigin: 'right',
|
||||
transition: 'transform 0.45s cubic-bezier(.22,.61,.36,1)',
|
||||
transitionProperty: 'transform',
|
||||
transitionDuration: 'interaction',
|
||||
transitionTimingFunction: 'smooth',
|
||||
},
|
||||
'&:hover::after, &:focus-visible::after, &[aria-current="page"]::after':
|
||||
{
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
import { defineRecipe } from '@chakra-ui/react';
|
||||
|
||||
// De hoekige knop uit het design (.btn). In het design is elke knop een link,
|
||||
// vandaar de naam. Gebruik via de LinkButton-component.
|
||||
const linkButtonRecipe = defineRecipe({
|
||||
className: 'link-button',
|
||||
base: {
|
||||
display: 'inline-flex',
|
||||
alignItems: 'center',
|
||||
gap: 3,
|
||||
px: '2.4rem',
|
||||
py: '1.05rem',
|
||||
borderWidth: '1px',
|
||||
borderStyle: 'solid',
|
||||
rounded: 'none',
|
||||
textStyle: 'eyebrow',
|
||||
fontWeight: '400',
|
||||
transitionProperty: 'background, color, border-color',
|
||||
transitionDuration: 'interaction',
|
||||
transitionTimingFunction: 'smooth',
|
||||
},
|
||||
variants: {
|
||||
variant: {
|
||||
// Donkere rand op papier
|
||||
outline: {
|
||||
borderColor: 'ink',
|
||||
color: 'ink',
|
||||
_hover: { bg: 'ink', color: 'paper' },
|
||||
_focusVisible: { bg: 'ink', color: 'paper' },
|
||||
},
|
||||
// Gevuld met het heidegroen
|
||||
accent: {
|
||||
borderColor: 'accent',
|
||||
bg: 'accent',
|
||||
color: 'white',
|
||||
_hover: { bg: 'accent.deep', borderColor: 'accent.deep' },
|
||||
_focusVisible: { bg: 'accent.deep', borderColor: 'accent.deep' },
|
||||
},
|
||||
// Wit, voor over foto's
|
||||
light: {
|
||||
borderColor: 'white/70',
|
||||
color: 'white',
|
||||
_hover: { bg: 'white', borderColor: 'white', color: 'ink' },
|
||||
_focusVisible: { bg: 'white', borderColor: 'white', color: 'ink' },
|
||||
},
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'outline',
|
||||
},
|
||||
});
|
||||
|
||||
export default linkButtonRecipe;
|
||||
+88
-2
@@ -1,4 +1,5 @@
|
||||
import { createSystem, defaultConfig, defineConfig } from '@chakra-ui/react';
|
||||
import linkButtonRecipe from './recipes/linkButton';
|
||||
|
||||
const config = defineConfig({
|
||||
cssVarsRoot: ':where(:root, :host)',
|
||||
@@ -19,6 +20,25 @@ const config = defineConfig({
|
||||
// '2xl': '1536px',
|
||||
// },
|
||||
tokens: {
|
||||
// Palet uit design/andreaslop-static (:root in style.css)
|
||||
colors: {
|
||||
paper: {
|
||||
DEFAULT: { value: '#faf7f2' }, // hoofdachtergrond, warm papier
|
||||
alt: { value: '#f1ebe2' }, // secundaire secties
|
||||
deep: { value: '#e8e0d5' }, // randen van blokken, hover-vlakken
|
||||
},
|
||||
ink: {
|
||||
DEFAULT: { value: '#232120' }, // koppen en hoofdtekst
|
||||
soft: { value: '#55504b' }, // lopende tekst
|
||||
muted: { value: '#8a827a' }, // bijschriften, meta
|
||||
},
|
||||
line: { value: '#e2dad0' }, // hairlines
|
||||
accent: {
|
||||
DEFAULT: { value: '#7f8b76' }, // heidegroen
|
||||
deep: { value: '#5f6a58' }, // accent hover
|
||||
},
|
||||
sand: { value: '#d9cdbc' }, // zachte vlakken en decoratie
|
||||
},
|
||||
fonts: {
|
||||
heading: {
|
||||
value: "'Marcellus', 'Iowan Old Style', Georgia, 'Times New Roman', serif",
|
||||
@@ -27,13 +47,39 @@ const config = defineConfig({
|
||||
value: "'Jost', 'Helvetica Neue', Helvetica, Arial, sans-serif",
|
||||
},
|
||||
},
|
||||
fontSizes: {
|
||||
eyebrow: { value: '0.72rem' },
|
||||
},
|
||||
letterSpacings: {
|
||||
caps: { value: '0.22em' }, // hoofdletterlabels: eyebrows, knoppen, nav
|
||||
},
|
||||
spacing: {
|
||||
gutter: { value: 'clamp(1.25rem, 4vw, 3rem)' }, // zijmarge van de pagina
|
||||
},
|
||||
easings: {
|
||||
smooth: { value: 'cubic-bezier(.22, .61, .36, 1)' },
|
||||
},
|
||||
durations: {
|
||||
interaction: { value: '0.45s' }, // hover, focus
|
||||
fade: { value: '1.2s' }, // overvloeien van foto's
|
||||
},
|
||||
gradients: {
|
||||
// Donker verloop over hero-foto's, zodat witte tekst leesbaar blijft
|
||||
scrim: {
|
||||
value:
|
||||
'linear-gradient(to bottom, ' +
|
||||
'color-mix(in srgb, {colors.ink} 45%, transparent) 0%, ' +
|
||||
'color-mix(in srgb, {colors.ink} 18%, transparent) 35%, ' +
|
||||
'color-mix(in srgb, {colors.ink} 45%, transparent) 100%)',
|
||||
},
|
||||
},
|
||||
},
|
||||
semanticTokens: {
|
||||
colors: {
|
||||
bg: {
|
||||
DEFAULT: {
|
||||
value: {
|
||||
_light: '{colors.orange.100}',
|
||||
_light: '{colors.paper}',
|
||||
_dark: '{colors.gray.800}',
|
||||
},
|
||||
},
|
||||
@@ -41,12 +87,52 @@ const config = defineConfig({
|
||||
fg: {
|
||||
DEFAULT: {
|
||||
value: {
|
||||
_light: '{colors.gray.900}',
|
||||
_light: '{colors.ink}',
|
||||
_dark: '{colors.gray.50}',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sizes: {
|
||||
header: {
|
||||
// Hoogte van de navigatiebalk (h="header")
|
||||
DEFAULT: { value: { base: '66px', lg: '92px' } },
|
||||
// Na scrollen; op mobiel krimpt de balk niet
|
||||
sticky: { value: { base: '66px', lg: '68px' } },
|
||||
},
|
||||
},
|
||||
spacing: {
|
||||
// Zelfde waarde voor content die onder de balk begint (pt="header")
|
||||
header: { value: '{sizes.header}' },
|
||||
},
|
||||
},
|
||||
textStyles: {
|
||||
// Klein label in hoofdletters boven een kop
|
||||
eyebrow: {
|
||||
value: {
|
||||
fontSize: 'eyebrow',
|
||||
letterSpacing: 'caps',
|
||||
textTransform: 'uppercase',
|
||||
},
|
||||
},
|
||||
// Grote titel in de hero
|
||||
display: {
|
||||
value: {
|
||||
fontFamily: 'heading',
|
||||
fontSize: { base: '2.75rem', md: '3.75rem', xl: '5rem' },
|
||||
lineHeight: '1',
|
||||
},
|
||||
},
|
||||
},
|
||||
recipes: {
|
||||
// Koppen zijn in het design niet vet en iets gespatieerd
|
||||
heading: {
|
||||
base: {
|
||||
fontWeight: '400',
|
||||
letterSpacing: '0.01em',
|
||||
},
|
||||
},
|
||||
linkButton: linkButtonRecipe,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user