Restructure the repo into npm workspaces so the component kit publishes as its own package, like MUI and shadcn/ui: - packages/ui: @openkhalix/tansy-ui (published), with components, stories, tests, tokens and the library build - packages/brand: private logo and catalogue data shared by both apps - apps/site: the landing page - apps/docs: Storybook The package: - MIT licence (copyright OpenKhalix) - per-component ES modules and type declarations - "use client" on component modules so they import into Next.js Server Components; helpers stay server-safe - tokens.css for Tailwind v4 apps, and a prebuilt styles.css for apps without Tailwind - lucide-react 1.x, whose types compile against current React 19 types The apps resolve the package through a "source" export condition, so they hot-reload component edits, while outside users get dist/. scripts/test-package.mjs packs the package and installs the tarball into Vite + Tailwind (strict types), plain React and Next.js apps; each must build and render correctly. Gitea workflows run CI on push and publish to npm when a vX.Y.Z tag matching the package version is pushed.
77 lines
2.7 KiB
TypeScript
77 lines
2.7 KiB
TypeScript
import type { ReactNode } from 'react'
|
|
import { VERSION } from '@openkhalix/tansy-ui'
|
|
import { TansyMark } from '@tansy/brand'
|
|
|
|
/*
|
|
* Building blocks for the Storybook Introduction pages. They sit inside
|
|
* `sb-unstyled` so Storybook's docs typography does not restyle them, and use
|
|
* inline styles so they read the same in every palette.
|
|
*/
|
|
|
|
const ink = '#12151c'
|
|
const muted = '#6b7384'
|
|
const line = '#dde1e8'
|
|
const display = '"Schibsted Grotesk", "Instrument Sans", sans-serif'
|
|
const mono = '"JetBrains Mono", ui-monospace, monospace'
|
|
|
|
/** Page header: mark, title, one-line summary and the kit version. */
|
|
export function DocHero({ title, children }: { title: string; children: ReactNode }) {
|
|
return (
|
|
<div className="sb-unstyled" style={{ display: 'flex', gap: 18, alignItems: 'flex-start', margin: '4px 0 32px' }}>
|
|
<TansyMark size={52} style={{ flexShrink: 0, marginTop: 4 }} />
|
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
|
|
<span style={{ fontFamily: mono, fontSize: 12, letterSpacing: '0.06em', textTransform: 'uppercase', color: muted }}>
|
|
Tansy UI · v{VERSION}
|
|
</span>
|
|
<h1 style={{ margin: 0, fontFamily: display, fontWeight: 800, fontSize: 38, lineHeight: 1.05, letterSpacing: '-0.035em', color: ink }}>
|
|
{title}
|
|
</h1>
|
|
<p style={{ margin: 0, maxWidth: 620, fontSize: 16, lineHeight: 1.6, color: '#4a5162' }}>{children}</p>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export type DocCard = {
|
|
title: string
|
|
body: string
|
|
/** A Storybook path such as `/docs/introduction-theming--documentation`. */
|
|
path: string
|
|
}
|
|
|
|
/**
|
|
* Links that navigate the whole Storybook, not just the preview frame.
|
|
* `./?path=` resolves next to iframe.html, so it works at `/` in dev and
|
|
* under `/docs/` in production.
|
|
*/
|
|
export function DocCards({ items }: { items: DocCard[] }) {
|
|
return (
|
|
<div
|
|
className="sb-unstyled"
|
|
style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(230px, 1fr))', gap: 12, margin: '16px 0 32px' }}
|
|
>
|
|
{items.map((item) => (
|
|
<a
|
|
key={item.path}
|
|
href={`./?path=${item.path}`}
|
|
target="_top"
|
|
style={{
|
|
display: 'flex',
|
|
flexDirection: 'column',
|
|
gap: 6,
|
|
padding: '16px 18px',
|
|
border: `1px solid ${line}`,
|
|
borderRadius: 10,
|
|
background: '#fff',
|
|
color: ink,
|
|
textDecoration: 'none',
|
|
}}
|
|
>
|
|
<strong style={{ fontFamily: display, fontSize: 16, fontWeight: 700 }}>{item.title} →</strong>
|
|
<span style={{ fontSize: 14, lineHeight: 1.5, color: muted }}>{item.body}</span>
|
|
</a>
|
|
))}
|
|
</div>
|
|
)
|
|
}
|