list.tsx 1004 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import type { FC } from 'react'
  2. import Item from './item'
  3. import type { ConversationItem } from '@/models/share'
  4. type ListProps = {
  5. isPin?: boolean
  6. title?: string
  7. list: ConversationItem[]
  8. onOperate: (type: string, item: ConversationItem) => void
  9. onChangeConversation: (conversationId: string) => void
  10. currentConversationId: string
  11. }
  12. const List: FC<ListProps> = ({
  13. isPin,
  14. title,
  15. list,
  16. onOperate,
  17. onChangeConversation,
  18. currentConversationId,
  19. }) => {
  20. return (
  21. <div>
  22. {
  23. title && (
  24. <div className='mb-0.5 px-3 h-[26px] text-xs font-medium text-gray-500'>
  25. {title}
  26. </div>
  27. )
  28. }
  29. {
  30. list.map(item => (
  31. <Item
  32. key={item.id}
  33. isPin={isPin}
  34. item={item}
  35. onOperate={onOperate}
  36. onChangeConversation={onChangeConversation}
  37. currentConversationId={currentConversationId}
  38. />
  39. ))
  40. }
  41. </div>
  42. )
  43. }
  44. export default List