Markdown rendered, CSV/TSV as a table, images, PDFs, audio, video and sandboxed HTML in place, other text as code, with Download and Open in a new tab. Used by file chips, message attachments, the files modal, task files and the files browser. Co-Authored-By: Claude Opus 5.5 <[email protected]>
21 lines
607 B
TypeScript
21 lines
607 B
TypeScript
import { twMerge } from "tailwind-merge";
|
|
|
|
type Props = {
|
|
value: string;
|
|
header?: boolean;
|
|
};
|
|
|
|
/**
|
|
* One cell of a previewed CSV, its text kept to one readable width.
|
|
*/
|
|
export default function FilePreviewTableCell({ value, header }: Props) {
|
|
const className = twMerge(
|
|
"px-3 py-1.5 max-w-80 text-left align-top whitespace-pre-wrap wrap-break-word border-0 border-b border-r border-solid border-hairline",
|
|
header && "font-bold border-hairline-strong",
|
|
);
|
|
|
|
if (header) return <th className={className}>{value}</th>;
|
|
|
|
return <td className={className}>{value}</td>;
|
|
}
|