index.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use client'
  2. import type { FC, ReactNode } from 'react'
  3. import React from 'react'
  4. import cn from '@/utils/classnames'
  5. export type IFeaturePanelProps = {
  6. className?: string
  7. headerIcon?: ReactNode
  8. title: ReactNode
  9. headerRight?: ReactNode
  10. hasHeaderBottomBorder?: boolean
  11. noBodySpacing?: boolean
  12. children?: ReactNode
  13. }
  14. const FeaturePanel: FC<IFeaturePanelProps> = ({
  15. className,
  16. headerIcon,
  17. title,
  18. headerRight,
  19. hasHeaderBottomBorder,
  20. noBodySpacing,
  21. children,
  22. }) => {
  23. return (
  24. <div className={cn('rounded-xl border-t-[0.5px] border-l-[0.5px] bg-background-section-burn pb-3', noBodySpacing && '!pb-0', className)}>
  25. {/* Header */}
  26. <div className={cn('px-3 pt-2', hasHeaderBottomBorder && 'border-b border-divider-subtle')}>
  27. <div className='flex justify-between items-center h-8'>
  28. <div className='flex items-center space-x-1 shrink-0'>
  29. {headerIcon && <div className='flex items-center justify-center w-6 h-6'>{headerIcon}</div>}
  30. <div className='text-text-secondary system-sm-semibold'>{title}</div>
  31. </div>
  32. <div className='flex gap-2 items-center'>
  33. {headerRight && <div>{headerRight}</div>}
  34. </div>
  35. </div>
  36. </div>
  37. {/* Body */}
  38. {children && (
  39. <div className={cn(!noBodySpacing && 'mt-1 px-3')}>
  40. {children}
  41. </div>
  42. )}
  43. </div>
  44. )
  45. }
  46. export default React.memo(FeaturePanel)