-
Notifications
You must be signed in to change notification settings - Fork 377
Expand file tree
/
Copy pathMessageContainer.tsx
More file actions
42 lines (40 loc) · 1011 Bytes
/
MessageContainer.tsx
File metadata and controls
42 lines (40 loc) · 1011 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
import { cn } from '@/utils'
import { LoadingContainer } from '../LoadingContainer/LoadingContainer'
import { HorizontalContainer } from '../HorizontalContainer/HorizontalContainer'
export interface MessageContainerProps {
children: React.ReactNode
className?: string
wrap?: boolean
isLoading?: boolean
}
export function MessageContainer({
children,
className,
wrap = false,
isLoading = false,
}: MessageContainerProps) {
return (
<HorizontalContainer
data-component="MessageContainer"
className={cn(
'h-auto justify-center items-center p-4 bg-message-lucid rounded-2xl',
className,
)}
>
{isLoading ? (
<LoadingContainer
isLoading={isLoading}
className={cn(
'w-full overflow-hidden',
wrap ? 'whitespace-normal' : 'truncate',
className,
)}
>
{children}
</LoadingContainer>
) : (
children
)}
</HorizontalContainer>
)
}