container.tsx 1019 B

123456789101112131415161718192021222324252627282930
  1. import type { ComponentProps, FC, ReactNode } from 'react'
  2. import { forwardRef } from 'react'
  3. import classNames from '@/utils/classnames'
  4. export type PreviewContainerProps = ComponentProps<'div'> & {
  5. header: ReactNode
  6. mainClassName?: string
  7. }
  8. export const PreviewContainer: FC<PreviewContainerProps> = forwardRef((props, ref) => {
  9. const { children, className, header, mainClassName, ...rest } = props
  10. return <div className={className}>
  11. <div
  12. {...rest}
  13. ref={ref}
  14. className={classNames(
  15. 'flex flex-col w-full h-full overflow-y-auto rounded-l-xl border-t-[0.5px] border-l-[0.5px] border-components-panel-border bg-background-default-lighter shadow shadow-shadow-shadow-5',
  16. )}
  17. >
  18. <header className='pl-5 pt-4 pr-4 pb-3 border-b border-divider-subtle'>
  19. {header}
  20. </header>
  21. <main className={classNames('py-5 px-6 w-full h-full', mainClassName)}>
  22. {children}
  23. </main>
  24. </div>
  25. </div>
  26. })
  27. PreviewContainer.displayName = 'PreviewContainer'