import * as classNames from 'classnames'; import * as React from 'react'; import { OptionalComponentPropAndHTMLAttributes } from '../../types'; export type SpeechBubbleProps = { /** * Set the style `display: block;`. */ block?: boolean; /** * Display the tail on either the left or the right. * @default 'left' */ tailPosition?: 'left' | 'right'; /** * Elements to display above the speech bubble such as user name or time of post. */ header?: React.ReactChild; /** * Elements to display below the speech bubble such as user name or time of post. */ footer?: React.ReactChild; } & OptionalComponentPropAndHTMLAttributes; /** * Speech bubble component for displaying conversations / messages. */ const SpeechBubble = (props: SpeechBubbleProps) => { const { className, children, tailPosition = 'left', block, header, footer, component: Component = 'div', ...remainingProps } = props; return ( {typeof header !== 'undefined' && ( {header} )}
{children}
{typeof footer !== 'undefined' && ( {footer} )} ); }; export default React.memo(SpeechBubble);