index.tsx 667 B

1234567891011121314151617181920212223242526272829
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React from 'react'
  4. import cn from 'classnames'
  5. import Item from './item'
  6. import type { Collection } from '@/app/components/tools/types'
  7. type Props = {
  8. className?: string
  9. currentName: string
  10. list: Collection[]
  11. onChosen: (index: number) => void
  12. }
  13. const ToolNavList: FC<Props> = ({
  14. className,
  15. currentName,
  16. list,
  17. onChosen,
  18. }) => {
  19. return (
  20. <div className={cn(className)}>
  21. {list.map((item, index) => (
  22. <Item isCurrent={item.name === currentName} key={item.name} payload={item} onClick={() => onChosen(index)}></Item>
  23. ))}
  24. </div>
  25. )
  26. }
  27. export default React.memo(ToolNavList)