this repo has no description
1import { keyframes } from '@emotion/react';
2import Box from '@mui/material/Box';
3import Typography from '@mui/material/Typography';
4import { Rambi, type Mood } from './Rambi';
5
6const fadeIn = keyframes`
7 from { opacity: 0; transform: translateY(8px); }
8 to { opacity: 1; transform: translateY(0); }
9`;
10
11interface SpeechBubbleProps {
12 mood?: Mood;
13 size?: number;
14 message: string;
15}
16
17export function SpeechBubble({ mood = 'idle', size = 80, message }: SpeechBubbleProps) {
18 return (
19 <Box
20 sx={{
21 display: 'flex',
22 alignItems: 'flex-end',
23 gap: 1.5,
24 }}
25 >
26 <Rambi mood={mood} size={size} />
27 <Box
28 sx={{
29 position: 'relative',
30 bgcolor: 'rgba(255,255,255,0.95)',
31 borderRadius: 3,
32 px: 2,
33 py: 1,
34 maxWidth: 220,
35 animation: `${fadeIn} 0.4s ease-out`,
36 boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
37 // Speech bubble tail
38 '&::before': {
39 content: '""',
40 position: 'absolute',
41 left: -6,
42 bottom: 12,
43 width: 0,
44 height: 0,
45 borderTop: '6px solid transparent',
46 borderBottom: '6px solid transparent',
47 borderRight: '8px solid rgba(255,255,255,0.95)',
48 },
49 }}
50 >
51 <Typography
52 variant="body2"
53 sx={{ fontWeight: 600, color: '#333', lineHeight: 1.3 }}
54 >
55 {message}
56 </Typography>
57 </Box>
58 </Box>
59 );
60}