-
Notifications
You must be signed in to change notification settings - Fork 374
Expand file tree
/
Copy pathHorizontalContainer.tsx
More file actions
44 lines (40 loc) · 1021 Bytes
/
HorizontalContainer.tsx
File metadata and controls
44 lines (40 loc) · 1021 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 HorizontalContainerProps
extends React.HTMLAttributes<HTMLDivElement> {
scroll?: boolean
}
export const HorizontalContainer = React.forwardRef<
HTMLDivElement,
HorizontalContainerProps
>(({ children, className, scroll = false, ...props }, ref) => {
return scroll ? (
<ScrollContainer
ref={ref}
direction="horizontal"
>
<HorizontalContainer
{...props}
scroll={false}
className={cn('overflow-visible w-fit', className)}
>
{children}
</HorizontalContainer>
</ScrollContainer>
) : (
<div
ref={ref}
data-component="HorizontalContainer"
{...props}
className={cn(
'w-full h-full overflow-hidden',
className,
'flex flex-row',
)}
>
{children}
</div>
)
})
HorizontalContainer.displayName = 'HorizontalContainer'