From a42116e56a7f20a053f420c85788930940a8ccf0 Mon Sep 17 00:00:00 2001 From: "Jusung Hwang (nabigraphics)" Date: Wed, 27 Jul 2022 02:47:47 +0900 Subject: [PATCH 1/2] docs(table): fix example code --- website/docs/table/example.md | 57 ++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/website/docs/table/example.md b/website/docs/table/example.md index 66e3585a..398d3eda 100644 --- a/website/docs/table/example.md +++ b/website/docs/table/example.md @@ -6,30 +6,45 @@ title: Example [View Source on GitHub](https://github.com/h6s-dev/h6s/blob/main/examples/react/src/pages/table/index.tsx) ```tsx -import { useCalendar } from '@h6s/calendar' +import { useTable } from '@h6s/table' -export default function Calendar() { - const { headers, body, view } = useCalendar() +export default function Table() { + const [{ theadGroups, rows }, controls] = useTable({ + model: myTableModel, + source: products, + }) return ( - - - - {headers.weekDays.map(({ key, value }) => { - return - })} - - - - {body.value.map(({ key, value: days }) => ( - - {days.map(({ key, value }) => ( - - ))} - - ))} - -
{format(value, 'E', { locale })}
{getDate(value)}
+ + + {theadGroups.map(({ theads, getRowProps }) => { + const props = getRowProps() + + return ( + + {theads.map(head => ( + + ))} + + ) + })} + + + {rows.map(({ cells, getRowProps }) => { + const props = getRowProps() + + return ( + + {cells.map(cell => ( + cell.colSpan !== 0 + ? + : null + )} + + ) + })} + +
{head.render({ cellProps: head })}
{cell.render({ cellProps: cell })}
) } ``` From d914265c39762bc65fb7b2dd33a485dcea78eb58 Mon Sep 17 00:00:00 2001 From: "Jusung Hwang (nabigraphics)" Date: Wed, 27 Jul 2022 02:48:05 +0900 Subject: [PATCH 2/2] docs(table): fix iframe title --- website/docs/table/example.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/table/example.md b/website/docs/table/example.md index 398d3eda..7a89fa48 100644 --- a/website/docs/table/example.md +++ b/website/docs/table/example.md @@ -51,7 +51,7 @@ export default function Table() {