Start table

This commit is contained in:
Samy Pessé
2023-10-29 13:49:31 -04:00
parent e62f91dc0d
commit 66157393ea
4 changed files with 35 additions and 0 deletions
+3
View File
@@ -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<T> extends DocumentContextProps {
block: T;
@@ -43,6 +44,8 @@ export function Block<T>(props: BlockProps<T>) {
return <Tabs {...props} {...contextProps} />;
case 'expandable':
return <Expandable {...props} {...contextProps} />;
case 'table':
return <Table {...props} {...contextProps} />
default:
return <div className={tcls(style)}>Unsupported block {block.type}</div>;
}
@@ -0,0 +1,19 @@
import { BlockProps } from "../Block";
import { ViewCards } from "./ViewCards";
export interface TableViewProps<View> extends BlockProps<any> {
view: View;
record: any[];
}
export function Table(props: BlockProps<any>) {
const { block } = props;
switch (block.data.view.type) {
case 'cards':
return <ViewCards view={block.data.view} {...props} />;
default:
return <div>Unsupported view {block.data.view.type}</div>
}
}
@@ -0,0 +1,12 @@
import { TableViewProps } from "./Table";
export function ViewCards(props: TableViewProps<any>) {
return (
<div>
<div>Cards!</div>
</div>
)
}
@@ -0,0 +1 @@
export * from './Table';