This commit is contained in:
bakhirev 2024-08-15 14:53:19 +03:00
parent 886c258357
commit f61e829555

View file

@ -0,0 +1,42 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import { IColumn } from 'ts/components/Table/interfaces/Column';
import style from '../styles/index.module.scss';
interface LineWithTemplateProps {
column: IColumn;
item: any;
className?: string | Function;
value: React.ReactNode | React.ReactNode[] | null;
}
function LineWithTemplate({
column,
item,
className,
value,
}: LineWithTemplateProps): JSX.Element | null {
const { t } = useTranslation();
const columnClassName = typeof column.className === 'function'
? column.className('body', item)
: column.className;
if (!value) return null;
return (
<div className={`${style.card_line_with_template} ${className || ''} ${columnClassName || ''}`}>
<div className={style.card_line_with_template_title}>
{t(column.title || '')}
</div>
{value}
</div>
);
}
LineWithTemplate.defaultPeops = {
className: '',
};
export default LineWithTemplate;