From 66157393ea7b709c54eeb50934a4fb795adcf13a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Sun, 29 Oct 2023 13:49:31 -0400 Subject: [PATCH] Start table --- src/components/DocumentView/Block.tsx | 3 +++ src/components/DocumentView/Table/Table.tsx | 19 +++++++++++++++++++ .../DocumentView/Table/ViewCards.tsx | 12 ++++++++++++ src/components/DocumentView/Table/index.ts | 1 + 4 files changed, 35 insertions(+) create mode 100644 src/components/DocumentView/Table/Table.tsx create mode 100644 src/components/DocumentView/Table/ViewCards.tsx create mode 100644 src/components/DocumentView/Table/index.ts diff --git a/src/components/DocumentView/Block.tsx b/src/components/DocumentView/Block.tsx index 9e96e066a..01456640f 100644 --- a/src/components/DocumentView/Block.tsx +++ b/src/components/DocumentView/Block.tsx @@ -11,6 +11,7 @@ import { DocumentContextProps } from './DocumentView'; import { Images } from './Images'; import { Tabs } from './Tabs'; import { Expandable } from './Expandable'; +import { Table } from './Table'; export interface BlockProps extends DocumentContextProps { block: T; @@ -43,6 +44,8 @@ export function Block(props: BlockProps) { return ; case 'expandable': return ; + case 'table': + return default: return
Unsupported block {block.type}
; } diff --git a/src/components/DocumentView/Table/Table.tsx b/src/components/DocumentView/Table/Table.tsx new file mode 100644 index 000000000..deaa32921 --- /dev/null +++ b/src/components/DocumentView/Table/Table.tsx @@ -0,0 +1,19 @@ +import { BlockProps } from "../Block"; +import { ViewCards } from "./ViewCards"; + +export interface TableViewProps extends BlockProps { + view: View; + record: any[]; +} + +export function Table(props: BlockProps) { + const { block } = props; + + switch (block.data.view.type) { + case 'cards': + return ; + default: + return
Unsupported view {block.data.view.type}
+ } +} + diff --git a/src/components/DocumentView/Table/ViewCards.tsx b/src/components/DocumentView/Table/ViewCards.tsx new file mode 100644 index 000000000..e0f54121d --- /dev/null +++ b/src/components/DocumentView/Table/ViewCards.tsx @@ -0,0 +1,12 @@ +import { TableViewProps } from "./Table"; + + +export function ViewCards(props: TableViewProps) { + + return ( +
+
Cards!
+
+ ) +} + diff --git a/src/components/DocumentView/Table/index.ts b/src/components/DocumentView/Table/index.ts new file mode 100644 index 000000000..75193adc3 --- /dev/null +++ b/src/components/DocumentView/Table/index.ts @@ -0,0 +1 @@ +export * from './Table';