toggle-expand-btn.tsx 684 B

12345678910111213141516171819202122232425
  1. 'use client'
  2. import type { FC } from 'react'
  3. import React, { useCallback } from 'react'
  4. import { Expand04 } from '@/app/components/base/icons/src/vender/solid/arrows'
  5. import { Collapse04 } from '@/app/components/base/icons/src/vender/line/arrows'
  6. type Props = {
  7. isExpand: boolean
  8. onExpandChange: (isExpand: boolean) => void
  9. }
  10. const ExpandBtn: FC<Props> = ({
  11. isExpand,
  12. onExpandChange,
  13. }) => {
  14. const handleToggle = useCallback(() => {
  15. onExpandChange(!isExpand)
  16. }, [isExpand])
  17. const Icon = isExpand ? Collapse04 : Expand04
  18. return (
  19. <Icon className='w-3.5 h-3.5 text-gray-500 cursor-pointer' onClick={handleToggle} />
  20. )
  21. }
  22. export default React.memo(ExpandBtn)