import { FC, WebCellProps } from 'web-cell'; import { JsxChildren } from 'dom-renderer'; import classNames from 'classnames'; export interface MediaObjectProps extends WebCellProps { listItem?: boolean; title: string; image: JsxChildren; imageRow?: 'start' | 'center' | 'end'; imageColumn?: 'start' | 'end'; } export const MediaObject: FC = ({ className, listItem, title, image, imageRow = 'start', imageColumn = 'start', children, ...rest }) => { const start = imageColumn === 'start'; const Tag = listItem ? 'li' : 'div', Class = classNames('d-flex', !start && 'flex-row-reverse', className); const body = ( <>
{typeof image === 'string' ? ( {title} ) : ( image )}
{title}
{children}
); return ( {body} ); };