import React, { FunctionComponent, HTMLAttributes, ReactNode } from 'react'; import classNames from '../../lib/classNames'; import usePlatform from '../../hooks/usePlatform'; import getClassName from '../../helpers/getClassName'; import { HasRootRef } from '../../types'; import Tappable from '../Tappable/Tappable'; export interface RichCellProps extends HTMLAttributes, HasRootRef { text?: ReactNode; caption?: ReactNode; /** * `` */ before?: ReactNode; /** * Иконка 28 или текст */ after?: ReactNode; /** * Например `` */ bottom?: ReactNode; /** * Кнопка или набор кнопок `` */ actions?: ReactNode; disabled?: boolean; multiline?: boolean; href?: string; target?: string; } const RichCell: FunctionComponent = ({ children, text, caption, before, after, bottom, actions, multiline, className, ...restProps }) => { const platform = usePlatform(); const isAfterPrimitive = typeof after === 'string' || typeof after === 'number'; return ( {before} {/* Этот after будет скрыт из верстки. Он нужен для CSS */} {isAfterPrimitive ? {after} : after} {children} {after && {after}} {text && {text}} {caption && {caption}} {(bottom || actions) && {bottom} {actions && {actions}} } ); }; export default RichCell;