diff --git a/src/components/table-cell/GenericCell.tsx b/src/components/table-cell/GenericCell.tsx index 42ad7edb..abc11c38 100644 --- a/src/components/table-cell/GenericCell.tsx +++ b/src/components/table-cell/GenericCell.tsx @@ -2,8 +2,10 @@ import { useMemo } from "react"; import styles from "./styles.module.css"; import { isLinkString } from "@/lib/validation"; import DisplayLinkCell from "./display-link-cell"; +import { cn } from "@/lib/utils"; interface TableCellProps { + align?: "left" | "right"; value: T; focus?: boolean; isChanged?: boolean; @@ -16,6 +18,7 @@ export default function GenericCell({ onFocus, isChanged, focus, + align, onDoubleClick, }: TableCellProps) { const className = [ @@ -27,13 +30,17 @@ export default function GenericCell({ .filter(Boolean) .join(" "); + const isAlignRight = align === "right"; + + const textBaseStyle = cn("text-gray-500", isAlignRight ? "float-right" : ""); + const content = useMemo(() => { if (value === null) { - return NULL; + return NULL; } if (value === undefined) { - return DEFAULT; + return DEFAULT; } if (typeof value === "string") { @@ -88,7 +95,7 @@ export default function GenericCell({ } return {value.toString()}; - }, [value, isChanged]); + }, [value, textBaseStyle, isChanged]); return (
({ value={toValue(editValue)} focus={focus} isChanged={isChanged} + align={align} onDoubleClick={() => { state.enterEditMode(); }}