plazbot
Version:
Official Plazbot SDK for creating AI agents for WhatsApp, portals, and developers.
25 lines (24 loc) • 1.27 kB
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { usePlazbotContext } from '../../context/PlazbotContext';
import { MarkdownRenderer } from '../utils/MarkdownRenderer';
export function MessageBubble({ message, style }) {
const { theme } = usePlazbotContext();
const isUser = message.role === 'user';
return (_jsx("div", { style: {
display: 'flex',
justifyContent: isUser ? 'flex-end' : 'flex-start',
animation: 'plazbot-fade-in 0.2s ease-out',
...style,
}, children: _jsx("div", { style: {
maxWidth: '80%',
padding: '10px 14px',
borderRadius: theme.borderRadius,
backgroundColor: isUser ? theme.bubbleUserBg : theme.bubbleAgentBg,
color: isUser ? theme.bubbleUserText : theme.bubbleAgentText,
fontFamily: theme.fontFamily,
fontSize: theme.fontSize,
lineHeight: 1.5,
borderBottomRightRadius: isUser ? '2px' : theme.borderRadius,
borderBottomLeftRadius: isUser ? theme.borderRadius : '2px',
}, children: isUser ? (_jsx("span", { children: message.content })) : (_jsx(MarkdownRenderer, { content: message.content })) }) }));
}