用法
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(图片地址)可替换它。 |
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。Agent 会读取公开的源码,先告诉你要写入哪些文件,再把区块连同它用到的组件一起加进项目。
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 会一起装进同一个文件夹。