File tree Expand file tree Collapse file tree
src/components/DataDictionary/components/Table/components/BasicCell Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,15 +2,19 @@ import { Typography } from "@mui/material";
22import { CellContext , RowData } from "@tanstack/react-table" ;
33import React , { ReactNode } from "react" ;
44import { TYPOGRAPHY_PROPS } from "../../../../../../styles/common/mui/typography" ;
5+ import { parseValue } from "./utils" ;
56
6- export const BasicCell = < T extends RowData , TValue > ( {
7+ export const BasicCell = <
8+ T extends RowData ,
9+ TValue extends ReactNode = ReactNode
10+ > ( {
711 getValue,
812} : CellContext < T , TValue > ) : JSX . Element | null => {
913 const value = getValue ( ) ;
1014 if ( value === undefined || value === null ) return null ;
1115 return (
1216 < Typography variant = { TYPOGRAPHY_PROPS . VARIANT . INHERIT } >
13- { value as ReactNode }
17+ { parseValue ( value ) }
1418 </ Typography >
1519 ) ;
1620} ;
Original file line number Diff line number Diff line change 1+ import { ReactNode } from "react" ;
2+
3+ /**
4+ * Returns a parsed value based on the original value.
5+ * If the value is a boolean, it is converted to its string representation ("true" or "false").
6+ * For all other types of ReactNode, the value is returned unchanged.
7+ * @param value - The original value.
8+ * @returns Parsed value or original value.
9+ */
10+ export function parseValue ( value : ReactNode ) : ReactNode {
11+ if ( typeof value === "boolean" ) return value . toString ( ) ;
12+ return value ;
13+ }
You can’t perform that action at this time.
0 commit comments