import { H1, H2, H3 } from '@hanzo/gui'; import React from 'react'; // gui's heading primitives — real h1/h2/h3 on web, sized Text on native, both // inheriting the theme's heading font. // // The type ramp is props rather than classes, so it survives on native, where a // className means nothing. `$lg` is min-width 1024 in the v5 media config — the // same breakpoint Tailwind's `lg:` means, so the ramp is unchanged. // // It is `$lg`, not `$gtLg`. The `gt*` names belong to the v4 media config and // this package builds on v5, whose keys are plain mobile-first min-widths. gui // does not consume a media prop it has no key for; it forwards it, and React // reports it as an unknown DOM attribute. A wrong breakpoint name is not a // smaller heading — it is no responsive rule at all. export interface HeadingProps extends React.ComponentPropsWithoutRef<'h1'> { level?: '1' | '2' | '3'; } const TAG = { '1': H1, '2': H2, '3': H3 } as const; const RAMP = { // Tokens, not numbers. `$n` publishes as `var(--text-*, )` through the // shared config, and @hanzo/design multiplies `--text-*` by `--type-scale` — // so these three lines are what lets a person's type-size setting reach a // heading at all. Written as `18` they would render identically today and // never move again. // // lineHeight is deliberately absent: gui derives it from the resolved size, // so it scales WITH the text. A fixed 24 next to an adjustable size is how // you get 32px text in a 24px box. '1': { fontSize: '$6', $lg: { fontSize: '$10', letterSpacing: -0.5 } }, '2': { fontSize: '$5', $lg: { fontSize: '$8' } }, '3': { fontSize: '$3', fontWeight: '600', $lg: { fontSize: '$6', fontWeight: '500' } }, } as const; export const Heading = React.forwardRef( function Heading({ level, ...rest }, ref) { const Tag = level ? TAG[level] : H2; return ( ); }, );