import React, {
forwardRef,
FC,
PropsWithChildren,
ComponentType,
useEffect,
useState,
} from 'react'
import { Position, PositionProps, Target } from '~/types'
import { styled, StitchedCSS } from '~/theme'
import { ScrollArea } from '~/components'
const InnerSharedStyled = styled('div', {
pointerEvents: 'all',
borderRadius: 4,
background: '$Background2dp',
border: '1px solid $OtherDivider',
maxHeight: 'calc(100vh - 30px)',
boxShadow: `0px 3px 16px 1px rgba(0,0,0,0.05)`,
})
export type OverlayProps
= {
Component: ComponentType
props: P
target: Target
positionProps: PositionProps
css?: StitchedCSS
}
export const GenericOverlay: FC = () => {
return 'x'
}
export const InnerShared = forwardRef<
HTMLDivElement,
PropsWithChildren<{
width?: number | string
css?: StitchedCSS
style?: any
}>
>(({ width, css, children, style }, ref) => {
return (
{children}
)
})
export type SharedOverlayProps = PropsWithChildren<{
css?: StitchedCSS
position: Position
}>
export default forwardRef(
({ position, children, css }, ref) => {
const placement =
position.placement === 'left'
? 'flex-start'
: position.placement === 'right'
? 'flex-end'
: 'center'
const [go, setgo] = useState(false)
useEffect(() => {
const x = requestAnimationFrame(() => {
setgo(true)
})
return () => {
cancelAnimationFrame(x)
}
}, [])
return (
)
}
)