使い方
import { BookingSummary } from './BookingSummary.jsx'
// Without callbacks it confirms the sample visit after a short wait. Wire it to your booking:
<BookingSummary
locale="en"
currency="USD"
day="2026-12-08"
time="10:30"
services={[{ id: 'cut', name: 'Cut & blow-dry', minutes: 60, price: 65 }]}
stylist={{ name: 'Mara', role: 'Senior stylist', look: 'long', tone: 'secondary' }}
address="14 Linden Row"
heldUntil={hold.expiresAt} // ms timestamp; the countdown starts at once
onHoldAgain={() => hold.renew()} // resolve with the new expiry
onConfirm={async ({ note, reminder }) => (await book({ note, reminder })).reference}
/>プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | 文言・日付・時刻・料金の言語。 |
day / time | 'YYYY-MM-DD' / 'HH:MM' | sample visit | 予約の開始日時(サロンの現地時刻)。 |
services | Array<{ id, name, minutes, price }> | sample services | 予約するメニュー。分数の合計で終了時刻、料金の合計で合計額を出します。 |
stylist | { name, role, avatar?, look?, tone? } | sample stylist | 担当者。look と tone で似顔絵の形と色が決まり、avatar(画像 URL)で置き換えられます。 |
address / currency | string | by locale | 場所と、料金の ISO 通貨コード。 |
freeChangeHours | number | 24 | 何時間前まで無料で変更できるか。 |
heldUntil | number | — | サーバー側のお取り置きの期限(ミリ秒)。渡すとすぐにカウントダウンします。渡さない場合、サンプルは最初の操作で始まります。 |
defaultReminder | boolean | true | リマインダーを最初からオンにするか。 |
loading | boolean | false | 読み込み中はカードのスケルトンを表示します。 |
error | boolean | string | false | 予約が確定できなかったことを再試行ボタン付きで表示。文字列で説明を置き換えます。 |
onConfirm | ({ note, reminder }) => Promise<string | void> | — | 予約を確定します。予約番号を返すと表示し、reject するとエラーを表示します。 |
onHoldAgain | () => Promise<number | void> | — | お取り置きが切れた後に再度押さえます。新しい期限を返します。 |
onAddToCalendar | ({ day, time, minutes, reference }) => void | — | 組み込みの .ics ダウンロードを置き換えます。 |
onDone / onRetry | () => void | — | 予約後にやり直すとき、エラー表示の再試行で呼ばれます(既定では再送信)。 |
labels | object | — | 組み込みの文言を置き換えます(キーは copy.js と同じ)。 |
className | string | — | ルート要素に追加されます。その他の属性もルートに渡ります。 |
プロジェクトに追加
プロンプトを Codex や Claude Code に貼り付けます。エージェントが公開ソースを読み、書き込むファイルを示してから、使っているコンポーネントと一緒にブロックを追加します。
BookingSummary.jsxbooking-summary.csscopy.jskit.jsxkit.cssui/base-button/ui/alert-banner/ui/success-check/ui/checkbox/ui/textarea/ui/skeleton-shimmer/tokens.cssREADME.md
ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。