diff options
Diffstat (limited to 'src/components/ScheduleTable.astro')
| -rw-r--r-- | src/components/ScheduleTable.astro | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/components/ScheduleTable.astro b/src/components/ScheduleTable.astro new file mode 100644 index 0000000..2f4b370 --- /dev/null +++ b/src/components/ScheduleTable.astro @@ -0,0 +1,31 @@ +--- +// 行事予定の一覧表。データは src/data/schedule/*.json から読む。 +// セルの中身は HTML(リンクを含む)としてそのまま出力する。 +import meetings from '@/data/schedule/meetings.json'; +import events from '@/data/schedule/events.json'; + +type Row = { date: string; title: string; place: string; note: string; source: string }; +type TableData = { columns: string[]; rows: Row[] }; + +const { variant } = Astro.props as { variant: 'meeting' | 'event' }; +const data: TableData = (variant === 'meeting' ? meetings : events) as TableData; +--- + +<table> + <thead> + <tr>{data.columns.map((column) => <th>{column}</th>)}</tr> + </thead> + <tbody> + { + data.rows.map((row) => ( + <tr> + <td set:html={row.date} /> + <td set:html={row.title} /> + <td set:html={row.place} /> + <td set:html={row.note} /> + <td set:html={row.source} /> + </tr> + )) + } + </tbody> +</table> |
