From fe50ef5e52d10752cbd1d24af8930db484fd94b9 Mon Sep 17 00:00:00 2001 From: Andrew Jiang Date: Wed, 31 Jan 2024 02:30:17 -0500 Subject: [PATCH] revert table styles --- packages/ui/app/src/mdx/base-components.tsx | 22 ++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/ui/app/src/mdx/base-components.tsx b/packages/ui/app/src/mdx/base-components.tsx index ca816a761a..dbfc77402a 100644 --- a/packages/ui/app/src/mdx/base-components.tsx +++ b/packages/ui/app/src/mdx/base-components.tsx @@ -25,7 +25,7 @@ export const Table: React.FC> = ({ className, . {...rest} className={classNames( className, - "block border-separate border-spacing-0 overflow-x-auto table-auto mb-3 text-sm max-w-full not-prose border border-border-default-light dark:border-border-default-dark rounded-lg bg-background-primary-light dark:bg-background-primary-dark" + "block border-separate border-spacing-0 overflow-x-auto table-auto mb-3 text-sm max-w-full not-prose" )} /> ); @@ -36,7 +36,7 @@ export const Thead: React.FC> = ({ class }; export const Tr: React.FC> = ({ className, ...rest }) => { - return ; + return ; }; export const Th: React.FC> = ({ className, ...rest }) => { @@ -45,7 +45,7 @@ export const Th: React.FC> = ({ className, {...rest} className={classNames( className, - "text-left truncate px-3 py-1 leading-7 border-b border-border-default-light dark:border-border-default-dark t-muted text-xs bg-background-primary-light dark:bg-background-primary-dark" + "text-left truncate px-3 py-1 leading-7 border-b border-border-default-light dark:border-border-default-dark first:pl-0 last:pr-0" )} /> ); @@ -56,12 +56,16 @@ export const Td: React.FC> = ({ className, return ( 200, - })} + className={classNames( + className, + "border-b border-border-default-light dark:border-border-default-dark px-3 py-1 leading-7 first:pl-0 last:pr-0", + { + // if the table has many columns, do not collapse short string content into multi-line: + "whitespace-nowrap": childrenAsString.length < 100, + // prevent table's auto sizing from collapsing a paragraph into a tall-skinny column of broken sentences: + "min-w-sm": childrenAsString.length > 200, + } + )} > {children}