mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-30 14:58:08 +00:00
80 lines
3.1 KiB
TypeScript
80 lines
3.1 KiB
TypeScript
import { ArrowRight } from 'lucide-react'
|
|
import { YStack } from '@/components/ui'
|
|
import { Action } from '@hanzo/ui/marketing'
|
|
import { Line } from '@/components/type'
|
|
import { openable } from '@/lib/repos'
|
|
|
|
/**
|
|
* The last thing a product page says: read it, or read the source.
|
|
*
|
|
* Eight pages carried this markup character-for-character and differed only in
|
|
* the heading and the two addresses — which is a component with three props,
|
|
* written eight times. The heading IS a prop rather than "Get started with
|
|
* {name}", because four of the eight say something better than that: "Load a
|
|
* table and ask it something", "Read the protocol", "Read before you run it".
|
|
* Deriving it from the name would have quietly replaced those four sentences.
|
|
*
|
|
* The two controls are `Action`, this site's one button shape in its two
|
|
* weights, rather than eight utilities restating it. The hover is the reason it
|
|
* has to be a rule: it is the one thing neither a style attribute nor a gui prop
|
|
* can say here.
|
|
*
|
|
* THE NAME IS `action`, NOT `hz-action`. This document's own rules dropped the
|
|
* prefix and this call site kept it, so the class matched nothing in 209KB of
|
|
* compiled CSS and both controls shipped as bare text — measured at 20px tall,
|
|
* no outline, no fill, under the 24px floor the site states for a tap target.
|
|
* A dead class name reads exactly like a live one in source; only the
|
|
* stylesheet can tell you which it is.
|
|
*
|
|
* `justifyContent` is the one thing stated on top of the rule. Below `sm` the
|
|
* pair is a column and each control stretches the measure, so a label with
|
|
* nothing centring it sits at the left edge of a full-width button.
|
|
*/
|
|
const CENTRED = { justify: "center" } as const
|
|
|
|
/**
|
|
* `docs` is optional: a product docs publishes no page for has no docs button,
|
|
* and a caller that passes nothing gets the source alone rather than a link to
|
|
* a 404. `lib/constants/products-metadata` is where which-products-have-a-page
|
|
* is answered, one verified URL at a time.
|
|
*
|
|
* `repo` is optional for the same reason, and a private one links the org: its
|
|
* own GitHub URL answers a reader with a 404.
|
|
*/
|
|
export function Start({ title, docs, repo }: { title: string; docs?: string; repo?: string }) {
|
|
return (
|
|
<YStack
|
|
render="section"
|
|
py={64}
|
|
borderTopWidth={1}
|
|
borderColor="var(--neutral-800)"
|
|
>
|
|
<YStack
|
|
width="100%"
|
|
maxW={768}
|
|
mx="auto"
|
|
px={16}
|
|
$platform-web={{ textAlign: 'center' }}
|
|
>
|
|
<Line render="h2" size="x2" weight="700" marginBottom={16}>
|
|
{title}
|
|
</Line>
|
|
<YStack justify="center" gap={12} $sm={{ flexDirection: 'row' }}>
|
|
{docs ? (
|
|
<Action href={docs} target="_blank" rel="noopener noreferrer" fill {...CENTRED}>
|
|
Read the docs <ArrowRight width={16} height={16} />
|
|
</Action>
|
|
) : null}
|
|
{repo ? (
|
|
<Action href={openable(repo, 'https://github.com/hanzoai')} target="_blank" rel="noopener noreferrer" {...CENTRED}>
|
|
View on GitHub
|
|
</Action>
|
|
) : null}
|
|
</YStack>
|
|
</YStack>
|
|
</YStack>
|
|
)
|
|
}
|
|
|
|
export default Start
|