import React from 'react'; import { useStyles, useTheme } from '../../core'; import { Stack } from '../Stack/Stack'; import { Text } from '../Text/Text'; import { Avatar } from '../Avatar/Avatar'; import { hexToRgba } from '../../core/color/utils'; interface MessageProps { author: string; avatarFallback: string; avatarSrc?: string; timestamp: string; isMe?: boolean; children: React.ReactNode; } export const Message: React.FC = ({ author, avatarFallback, avatarSrc, timestamp, isMe = false, children }) => { const { theme } = useTheme(); const createStyle = useStyles('message'); const containerClass = createStyle({ display: 'flex', gap: theme.spacing.md, flexDirection: isMe ? 'row-reverse' : 'row', }); const messageBubbleClass = createStyle({ padding: `${theme.spacing.sm} ${theme.spacing.md}`, borderRadius: '12px', backgroundColor: isMe ? hexToRgba(theme.colors.primary, 0.4) : theme.colors.backgroundSecondary, maxWidth: '75%', }); return (
{author} {timestamp}
{children}
); };