diff --git a/src/ts/components/Cards/components/Card.tsx b/src/ts/components/Cards/components/Card.tsx index bf5da03..ad1d10a 100644 --- a/src/ts/components/Cards/components/Card.tsx +++ b/src/ts/components/Cards/components/Card.tsx @@ -3,6 +3,7 @@ import React from 'react'; import { IColumn } from 'ts/components/Table/interfaces/Column'; import Line from './Line'; +import LineWithTemplate from './LineWithTemplate'; import Title from './Title'; import style from '../styles/index.module.scss'; @@ -19,6 +20,7 @@ function Card({ className, customStyle, }: ICardProps) { + let alreadySetHeader = false; const parts = lines.map((line: IColumn, columnIndex: number) => { const value = line.properties ? item[line.properties] @@ -28,13 +30,13 @@ function Card({ ? line.formatter(value) : value; - if (typeof line.template === 'function') { - return line.template(formattedValue, item); - } + const hasTemplate = typeof line.template === 'function'; + const content = hasTemplate // @ts-ignore + ? line.template(formattedValue, item) + : `${line.prefixes ?? ''}${formattedValue ?? ''}${line.suffixes ?? ''}`; - const content = `${line.prefixes ?? ''}${formattedValue ?? ''}${line.suffixes ?? ''}`; - - if (!columnIndex) { + if (!alreadySetHeader && line.title) { + alreadySetHeader = true; return (