index.tsx 1008 B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use client'
  2. import React, { useState } from 'react'
  3. import { useTranslation } from 'react-i18next'
  4. import { ArrowLeftIcon, Squares2X2Icon } from '@heroicons/react/24/solid'
  5. import classNames from '@/utils/classnames'
  6. import type { AppDetailResponse } from '@/models/app'
  7. type IAppBackProps = {
  8. curApp: AppDetailResponse
  9. }
  10. export default function AppBack({ curApp }: IAppBackProps) {
  11. const { t } = useTranslation()
  12. const [hovered, setHovered] = useState(false)
  13. return (
  14. <div
  15. className={classNames(`
  16. flex items-center h-7 pl-2.5 pr-2
  17. text-[#1C64F2] font-semibold cursor-pointer
  18. rounded-[10px]
  19. ${curApp && 'hover:bg-[#EBF5FF]'}
  20. `)}
  21. onMouseEnter={() => setHovered(true)}
  22. onMouseLeave={() => setHovered(false)}
  23. >
  24. {
  25. (hovered && curApp)
  26. ? <ArrowLeftIcon className='mr-1 w-[18px] h-[18px]' />
  27. : <Squares2X2Icon className='mr-1 w-[18px] h-[18px]' />
  28. }
  29. {t('common.menus.apps')}
  30. </div>
  31. )
  32. }