使い方
import { LandingHero } from './LandingHero.jsx'
// Your product in the phone: items with their own picture, reading and action, and the phone's words in one object.
// Or pass media={<img src="/app.png" alt="" />} to show your own picture instead of the phone.
<LandingHero
locale="en"
product="Bloom"
labels={{ eyebrow: 'New: brew timer', headline: ['Every cup dialled in,', 'brew after brew.'], lede: 'Bloom logs each brew and tells you what to change next.', note: 'Free for 30 brews a month.' }}
screen={{ needCare: (n) => n + ' brews to log', allHappy: 'All brews logged', streakIcon: 'cup', tabs: [{ icon: 'home', label: 'Today' }, { icon: 'cup', label: 'Brews' }, { icon: 'note', label: 'Notes' }, { icon: 'user', label: 'Me' }] }}
items={[
{ id: 'guji', name: 'Ethiopia Guji', detail: 'V60 · 15 g', icon: 'cup', reading: 'Extraction', level: 18, after: 21, max: 24, unit: '%',
action: { label: 'Log', icon: 'check', ask: 'Untasted', remind: 'Guji is waiting', done: 'Guji logged', after: 'Brew again tomorrow' } },
{ id: 'house', name: 'House espresso', detail: '18 g · 36 g out', image: '/beans/house.jpg', reading: 'Score', level: 86, status: 'Dialled in' },
]}
streak={12}
onSignUp={async (email) => (await fetch('/api/waitlist', { method: 'POST', body: email })).ok}
onAction={(id) => track('demo-action', { id })}
/>プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | 組み込みの文言とサンプルの植物の言語。 |
product | string | by locale | 製品名。電話の横の通知に表示され、読み上げにも使われます。 |
items | Array<{ id, name, detail?, image? | icon? | art?, reading?, level?, after?, max?, unit?, status?, action?: { label, icon?, ask?, remind?, done?, after? } }> | sample plants | 電話に並ぶ項目。`image`(画像 URL)、`icon`(kit のアイコン名か要素)、`art` で描きます。`level` がリングを満たします(最大 `max`、単位 `unit`)。`action` のある項目はそのボタンを出し、押すとリングが `after` へ。`remind`・`done`・`after` は電話の横の通知文、`ask` はリングの下に出ます。 |
screen | { today?, needCare?(n), allHappy?, fine?, streakIcon?, streakLabel?(n), allNote?(n), allSaid?(n), tabs?: Array<string | { icon, label }> } | — | 電話の画面の文言とアイコンをひとつのオブジェクトで。組み込みのものに重ねます(キーは copy.js と同じ)。 |
media | ReactNode | ({ product, locale }) => ReactNode | — | 電話の代わりに表示します。スクリーンショット、動画、独自のコンポーネントなど。 |
plants | Array<{ id, name, room, art: 'monstera' | 'fern' | 'snake', measure: 'moisture' | 'humidity', level, after?, need?: 'water' | 'mist', next? }> | — | 非推奨:サンプルの古い項目の形。`items` がないときは今も読みます。 |
streak | number | 12 | 連続でお世話した日数。すべての鉢をお世話すると 1 増えます。 |
status | 'idle' | 'sending' | 'done' | 'error' | 'idle' | 登録フォームを指定の状態で開きます。独自のリクエスト中などに。 |
onSignUp | (email) => Promise<boolean | void> | — | アドレスを登録します。false を返すか例外でエラー表示、それ以外は完了表示になります。 |
onAction | (id, item) => void | — | 訪問者が製品を試したとき(電話の中で項目の操作ボタンを押したとき)。 |
onCare | (id, need) => void | — | 非推奨:onAction と同じで、サンプルの必要(水やりか霧吹き)を渡します。 |
labels | object | — | 組み込みの文言を置き換えます(キーは copy.js と同じ)。 |
className | string | — | ルートの section に追加されます。 |
プロジェクトに追加
プロンプトを Codex や Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込むファイルを示してから、使っているコンポーネントと一緒にブロックを追加します。
LandingHero.jsxlanding-hero.csscopy.jskit.jsxkit.cssui/base-button/ui/rolling-number/ui/success-check/ui/text-input/ui/progress-ring/tokens.cssREADME.md
ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。