Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

examples.tsx

92 lines3.2 KB

1import { createFileRoute } from '@tanstack/react-router'
2​
3import { CodePanel, SiteFooter, SiteNav } from '#/components/site.tsx'
4import { EXAMPLES, EXAMPLES_SOURCE_URL } from '#/lib/examples.ts'
5​
6export const Route = createFileRoute('/examples')({
7 component: Examples,
8})
9​
10const CLONE_SNIPPET = `git clone https://github.com/modelschemas/modelschemas
11cd modelschemas && bun install
12cd examples/schema-studio && bun run dev`
13​
14function Examples() {
15 return (
16 <div className="min-h-screen text-ink">
17 <SiteNav active="examples" />
18​
19 <main className="mx-auto max-w-[1080px] px-6 pb-16">
20 <header className="pt-13">
21 <h1 className="m-0 mb-3 font-mono text-[clamp(22px,3.4vw,30px)] leading-[1.25] font-semibold tracking-[-0.01em]">
22 Examples<span className="text-tok-blue">▌</span>
23 </h1>
24 <p className="m-0 mb-6 max-w-[40em] text-[14.5px] text-ink-soft">
25 Three small TanStack Start apps showing the modelschemas packages in
26 real use. Each one runs hosted here, and each is a standalone app
27 you can clone and deploy to your own Cloudflare account.
28 </p>
29 </header>
30​
31 <div className="figure overflow-x-auto">
32 <table className="dtable">
33 <thead>
34 <tr>
35 <th>example</th>
36 <th>shows</th>
37 <th className="max-sm:hidden">package</th>
38 <th className="max-sm:hidden">source</th>
39 </tr>
40 </thead>
41 <tbody>
42 {EXAMPLES.map((example) => (
43 <tr key={example.slug}>
44 <td className="font-mono text-xs whitespace-nowrap">
45 <a
46 className="press-link"
47 href={`/examples/${example.slug}/`}
48 >
49 {example.slug}
50 </a>
51 </td>
52 <td className="max-w-[38em]">{example.blurb}</td>
53 <td className="font-mono text-xs whitespace-nowrap text-ink-faint max-sm:hidden">
54 {example.package}
55 </td>
56 <td className="font-mono text-xs whitespace-nowrap max-sm:hidden">
57 <a
58 className="press-link"
59 href={`${EXAMPLES_SOURCE_URL}/${example.slug}`}
60 >
61 github →
62 </a>
63 </td>
64 </tr>
65 ))}
66 </tbody>
67 </table>
68 </div>
69​
70 <div className="mt-8 max-w-[46em]">
71 <CodePanel title="run one locally" copyText={CLONE_SNIPPET}>
72 <code>
73 {CLONE_SNIPPET.split('\n').map((line) => (
74 <span key={line}>
75 <span className="prompt">$</span> {line}
76 {'\n'}
77 </span>
78 ))}
79 </code>
80 </CodePanel>
81 <p className="mt-2.5 font-mono text-xs text-ink-faint">
82 All three read from the live API at modelschemas.com — no key
83 needed. `bun run deploy` inside an example ships it to your own
84 workers.dev subdomain.
85 </p>
86 </div>
87 </main>
88​
89 <SiteFooter />
90 </div>
91 )