Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
feat(content): add table
Marc Seitz6e854138037f
diff --git a/components/mdx/components/feature-table.tsx b/components/mdx/components/feature-table.tsxnew file mode 100644index 00000000..ea251fa7--- /dev/null+++ b/components/mdx/components/feature-table.tsx@@ -0,0 +1,54 @@+import React from "react";++type Column = {+ header: string;+ key: string;+};++type Row = {+ [key: string]: string;+};++type TableProps = {+ columns: Column[];+ rows: Row[];+};++export const Table: React.FC<TableProps> = ({ columns, rows }) => {+ return (+ <div className="mt-6 flow-root">+ <div className="bg-gray- mx-4 my-2 overflow-x-auto rounded-lg border border-gray-300">+ <div className="inline-block min-w-full align-middle">+ <table className="min-w-full divide-y divide-gray-300">+ <thead>+ <tr>+ {columns.map((column) => (+ <th+ key={column.key}+ className="px-3 py-3.5 text-left text-sm font-semibold text-gray-900"+ >+ {column.header}+ </th>+ ))}+ </tr>+ </thead>+ <tbody className="divide-y divide-gray-200 bg-white">+ {rows.map((row, rowIndex) => (+ <tr key={rowIndex}>+ {columns.map((column) => (+ <td+ key={column.key}+ className="px-3 py-4 text-sm text-gray-900"+ >+ {row[column.key]}+ </td>+ ))}+ </tr>+ ))}+ </tbody>+ </table>+ </div>+ </div>+ </div>+ );+};diff --git a/components/mdx/components/index.tsx b/components/mdx/components/index.tsxindex 674811eb..3dd7f39d 100644--- a/components/mdx/components/index.tsx+++ b/components/mdx/components/index.tsx@@ -8,6 +8,7 @@ import { Button } from "@/components/ui/button";import { cn } from "@/lib/utils";+import { Table } from "./feature-table";import { MDXImage } from "./mdx-image";export const mdxComponents: MDXComponents = {@@ -85,5 +86,11 @@ export const mdxComponents: MDXComponents = {{children}</h3>),+ Table: ({ columns, rows, ...props }) => {+ if (!columns || !rows || columns.length === 0 || rows.length === 0)+ return null;++ return <Table columns={columns} rows={rows} {...props} />;+ },// any other components you want to use in your markdown};