diff --git a/app/transactions/transactions-view.tsx b/app/transactions/transactions-view.tsx index 14e777b..925c6ae 100644 --- a/app/transactions/transactions-view.tsx +++ b/app/transactions/transactions-view.tsx @@ -46,6 +46,7 @@ import { DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { Input } from "@/components/ui/input" +import { DataList } from "@/components/data-list" import { Select, SelectContent, @@ -294,6 +295,7 @@ export function TransactionsView({ ) : ( - diff --git a/components/data-list.tsx b/components/data-list.tsx new file mode 100644 index 0000000..82c281d --- /dev/null +++ b/components/data-list.tsx @@ -0,0 +1,127 @@ +import * as React from "react" +import { cn } from "cn" + +// Intended consumers: transactions, channels, and accounts. + +export type DataListRootProps = React.ComponentProps<"div"> & { + columns: string +} + +function DataListRoot({ + className, + columns, + style, + ...props +}: DataListRootProps) { + return ( +
+ ) +} + +function DataListHeader({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +export type DataListHeadProps = React.ComponentProps<"span"> & { + align?: "left" | "center" | "right" +} + +function DataListHead({ + align = "left", + className, + ...props +}: DataListHeadProps) { + return ( + + ) +} + +function DataListBody({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +function DataListRow({ className, ...props }: React.ComponentProps<"div">) { + return ( +
+ ) +} + +export type DataListCellProps = React.ComponentProps<"div"> & { + label?: React.ReactNode + labelClassName?: string + align?: "left" | "center" | "right" +} + +function DataListCell({ + align = "left", + children, + className, + labelClassName, + label, + ...props +}: DataListCellProps) { + return ( +
+ {label != null && ( + + {label} + + )} + {children} +
+ ) +} + +export const DataList = Object.assign(DataListRoot, { + Header: DataListHeader, + Head: DataListHead, + Body: DataListBody, + Row: DataListRow, + Cell: DataListCell, +})