-
Notifications
You must be signed in to change notification settings - Fork 380
Expand file tree
/
Copy pathVerticalContainer.tsx
More file actions
44 lines (40 loc) · 987 Bytes
/
VerticalContainer.tsx
File metadata and controls
44 lines (40 loc) · 987 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
44
import React from 'react'
import { cn } from '@sqlmesh-common/utils'
import { ScrollContainer } from '../ScrollContainer/ScrollContainer'
export interface VerticalContainerProps
extends React.HTMLAttributes<HTMLDivElement> {
scroll?: boolean
}
export const VerticalContainer = React.forwardRef<
HTMLDivElement,
VerticalContainerProps
>(({ children, className, scroll = false, ...props }, ref) => {
return scroll ? (
<ScrollContainer
ref={ref}
direction="vertical"
>
<VerticalContainer
{...props}
scroll={false}
className={cn('h-auto', className)}
>
{children}
</VerticalContainer>
</ScrollContainer>
) : (
<div
ref={ref}
data-component="VerticalContainer"
{...props}
className={cn(
'w-full h-full overflow-hidden',
className,
'flex flex-col',
)}
>
{children}
</div>
)
})
VerticalContainer.displayName = 'VerticalContainer'