mirror of
https://github.com/bakhirev/assayo.git
synced 2024-11-16 08:11:40 +00:00
update
This commit is contained in:
parent
886c258357
commit
f61e829555
42
src/ts/components/Cards/components/LineWithTemplate.tsx
Normal file
42
src/ts/components/Cards/components/LineWithTemplate.tsx
Normal 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;
|
Loading…
Reference in a new issue