import React, { ReactNode } from 'react'; import classNames from 'classnames'; import { Box, ContainerColor, as, color } from 'folds'; import * as css from './layout.css'; type BubbleArrowProps = { variant: ContainerColor; }; function BubbleLeftArrow({ variant }: BubbleArrowProps) { return ( ); } type BubbleLayoutProps = { hideBubble?: boolean; /** The sender is the signed-in user: right-aligned, in the accent colour, no avatar. */ own?: boolean; /** A Mind's pose portrait; it replaces the avatar and sits beside (wide) or inside (phone) the bubble. */ pose?: ReactNode; /** On phones the portrait floats on the other side. */ alt?: boolean; /** Delay in ms before the first-appearance animation; undefined plays none. */ enterDelay?: number; before?: ReactNode; header?: ReactNode; }; export const BubbleLayout = as<'div', BubbleLayoutProps>( ({ hideBubble, own, pose, alt, enterDelay, before, header, children, style, ...props }, ref) => { // `false` is a Mind's message continuing a run: aligned with the portraits, showing none. const poseRow = pose !== undefined; const arrow = !!before && !poseRow && !own; const entering = enterDelay !== undefined; return ( {!poseRow && !own && ( {before} )} {header && (
{header}
)} {hideBubble ? ( children ) : ( {arrow ? : null} {pose} {children} )}
); } );