File size: 1,025 Bytes
41a71fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { ReactNode } from 'react';
import { classNames } from '@/shared/lib/classNames/classNames';
import cls from './Cell.module.scss';

interface CellProps {
    className?: string;
    label?: string;
    withoutBorder?: boolean;
    fieldError?: any;
    noteText?: ReactNode;
    children: ReactNode;
}

export const Cell = (props: CellProps) => {
    const { className, label, withoutBorder, fieldError, noteText, children } = props;

    return (
        <div className={classNames(cls.Cell, {}, [className])}>
            {!withoutBorder && (
                <div className={cls.content}>
                    <label className={cls.name}>{label || ''}</label>
                    <div className={cls.data}>{children}</div>
                </div>
            )}
            {noteText && <div className={cls.note}>{noteText}</div>}
            {withoutBorder && children}
            {fieldError && <div className={cls.errorMessage}>{fieldError.message || 'Заполните поле'}</div>}
        </div>
    );
};