選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

footer.tsx 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React, { useState } from 'react'
  2. import Link from 'next/link'
  3. import { RiCloseLine, RiDiscordFill, RiGithubFill } from '@remixicon/react'
  4. import { useTranslation } from 'react-i18next'
  5. type CustomLinkProps = {
  6. href: string
  7. children: React.ReactNode
  8. }
  9. const CustomLink = React.memo(({
  10. href,
  11. children,
  12. }: CustomLinkProps) => {
  13. return (
  14. <Link
  15. className='flex h-8 w-8 cursor-pointer items-center justify-center transition-opacity duration-200 ease-in-out hover:opacity-80'
  16. target='_blank'
  17. rel='noopener noreferrer'
  18. href={href}
  19. >
  20. {children}
  21. </Link>
  22. )
  23. })
  24. const Footer = () => {
  25. const { t } = useTranslation()
  26. const [isVisible, setIsVisible] = useState(true)
  27. const handleClose = () => {
  28. setIsVisible(false)
  29. }
  30. if (!isVisible)
  31. return null
  32. return (
  33. <footer className='shrink-0 grow-0 px-12 py-2 relative'>
  34. <button
  35. onClick={handleClose}
  36. className='absolute top-2 right-2 flex h-6 w-6 cursor-pointer items-center justify-center rounded-full transition-colors duration-200 ease-in-out hover:bg-gray-100 dark:hover:bg-gray-800'
  37. aria-label="Close footer"
  38. >
  39. <RiCloseLine className='h-4 w-4 text-text-tertiary' />
  40. </button>
  41. <h3 className='text-gradient text-xl font-semibold leading-tight'>{t('app.join')}</h3>
  42. <p className='system-sm-regular mt-1 text-text-tertiary'>{t('app.communityIntro')}</p>
  43. <div className='mt-3 flex items-center gap-2'>
  44. <CustomLink href='https://github.com/langgenius/dify'>
  45. <RiGithubFill className='h-5 w-5 text-text-tertiary' />
  46. </CustomLink>
  47. <CustomLink href='https://discord.gg/FngNHpbcY7'>
  48. <RiDiscordFill className='h-5 w-5 text-text-tertiary' />
  49. </CustomLink>
  50. </div>
  51. </footer>
  52. )
  53. }
  54. export default React.memo(Footer)