「詳細ページ」は Pro に含まれます。解除するとプレビューが表示されます。
使い方
import { DetailPage } from './DetailPage.jsx'
<DetailPage
locale="en"
record={project} // { id, name, status: 'draft' | 'active' | 'review' | 'approved', client, owner, start, due, budget, spent, billing, about }
activity={project.events} // [{ id, kind: 'status' | 'comment' | 'file' | 'invoice' | 'created', icon?, who, text, when }]
statuses={[ // optional: your own statuses; Approve moves the record to the final one
{ id: 'open', label: 'Open', tone: 'progress' },
{ id: 'done', label: 'Done', tone: 'success', final: true },
]}
facts={[{ label: 'Client', value: project.client }, { label: 'Due', value: '4 Dec' }]}
files={project.files} // [{ name, meta }]
people={project.people} // [{ name, role, tone: 0-3 }]
next={{ name: 'Menu boards to print', date: '2026-12-04' }}
currency="EUR"
loading={!project}
onAction={async (which) => { // 'approve' | 'edit' | 'share'
if (which === 'approve') return (await fetch('/api/projects/' + project.id + '/approve', { method: 'POST' })).ok
if (which === 'edit') router.push('/projects/' + project.id + '/edit')
}}
onComment={async (text) => (await postComment(project.id, text)).ok}
onBack={() => router.push('/projects')}
/>プロパティ
| プロパティ | 型 | 既定値 | 説明 |
|---|---|---|---|
locale | 'en' | 'zh-CN' | 'es' | 'ja' | 'en' | 組み込みの文言、サンプルのレコード、日付と金額の書式の言語。 |
record | object | — | 表示するレコード(項目は使い方を参照)。 |
activity | Array<{ id, kind, who, text, when }> | — | タイムライン(新しい順)。空なら最初のコメントを促します。 |
statuses | Array<{ id, label, tone: 'neutral' | 'progress' | 'warning' | 'success' | 'danger', final? }> | 'draft, active, review, approved' | レコードの状態。`final` の状態にはチェックが付き、「承認」は最初の final 状態へ移してから消えます(final がなければ「承認」は出ません)。 |
currency | string | by locale | 予算の ISO 通貨コード(例: EUR。`record.currency` でも可)。 |
facts | Array<{ label, value }> | client, owner, start, due, budget, billing | 概要タブの行。組み込みのプロジェクト情報の代わりに表示され、コピーできる ID は最後に残ります。 |
files | Array<{ name, meta }> | sample files | ファイルタブの内容。 |
people | Array<{ name, role, tone?: 0 | 1 | 2 | 3 }> | sample people | タブ横のメンバーカード。イニシャルは名前から作られます。 |
next | { name, date: 'YYYY-MM-DD' } | null | sample milestone | 次のマイルストーンのカード。null で非表示。 |
defaultTab | 'overview' | 'activity' | 'files' | 'overview' | 最初に表示するタブ。 |
loading / error | boolean | — | 読み込み中はプレースホルダー、失敗時はメッセージと再試行(onRetry)。 |
onAction | (which: 'approve' | 'edit' | 'share', record) => Promise<boolean | void> | void | — | ヘッダーの操作が押されたとき。失敗なら false を返すと、承認でもステータスは変わりません。 |
onComment | (text) => Promise<boolean | void> | — | コメントが送信されたとき。 |
labels | object | — | 組み込みの文言を置き換えます(キーは copy.js と同じ)。 |
プロジェクトに追加
Pro にはこのブロックのソース一式が含まれます。指示をコピーしてエージェントに導入を依頼できます。
DetailPage.jsxdetail-page.csscopy.jskit.jsxkit.cssui/base-button/ui/copy-button/ui/status-tag/ui/alert-banner/ui/textarea/ui/skeleton-shimmer/ui/sliding-tabs/tokens.cssREADME.md
ブロック本体、スタイルと文言、共通の kit、使っているコンポーネント、tokens.css が 1 つのフォルダにまとめて入ります。
