-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathChattingBubble.tsx
More file actions
43 lines (39 loc) · 905 Bytes
/
ChattingBubble.tsx
File metadata and controls
43 lines (39 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
'use client';
import { cn } from '@/shared/lib';
import { cva, type VariantProps } from 'class-variance-authority';
const chatBubbleStyle = cva(
`
flex items-center
px-[1.9rem] py-[1.3rem]
rounded-[2rem]
text-label-lg foreground
break-words
w-fit max-w-[80%]
`,
{
variants: {
variant: {
received: 'bg-gray-100 self-start',
sent: 'bg-mint-100 self-end',
},
},
defaultVariants: {
variant: 'received',
},
},
);
interface ChattingProps extends VariantProps<typeof chatBubbleStyle> {
message: string;
}
export default function Chatting({ message, variant }: ChattingProps) {
return (
<div className='w-full flex flex-col'>
<div
className={cn(chatBubbleStyle({ variant }))}
aria-label={variant === 'sent' ? '내 메시지' : '상대방 메시지'}
>
{message}
</div>
</div>
);
}