item-panel.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import cn from 'classnames'
  5. import { RiQuestionLine } from '@remixicon/react'
  6. import Tooltip from '@/app/components/base/tooltip'
  7. type Props = {
  8. className?: string
  9. icon: JSX.Element
  10. name: string
  11. description: string
  12. children: JSX.Element
  13. }
  14. const ItemPanel: FC<Props> = ({
  15. className,
  16. icon,
  17. name,
  18. description,
  19. children,
  20. }) => {
  21. return (
  22. <div className={cn(className, 'flex justify-between items-center h-12 px-3 rounded-lg bg-gray-50')}>
  23. <div className='flex items-center'>
  24. {icon}
  25. <div className='ml-3 mr-1 leading-6 text-sm font-semibold text-gray-800'>{name}</div>
  26. <Tooltip
  27. htmlContent={
  28. <div className='w-[180px]'>
  29. {description}
  30. </div>
  31. }
  32. selector={`agent-setting-tooltip-${name}`}
  33. >
  34. <RiQuestionLine className='w-[14px] h-[14px] text-gray-400' />
  35. </Tooltip>
  36. </div>
  37. <div>
  38. {children}
  39. </div>
  40. </div>
  41. )
  42. }
  43. export default React.memo(ItemPanel)