You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dify-logo.tsx 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use client'
  2. import type { FC } from 'react'
  3. import classNames from '@/utils/classnames'
  4. import useTheme from '@/hooks/use-theme'
  5. import { basePath } from '@/utils/var'
  6. export type LogoStyle = 'default' | 'monochromeWhite'
  7. export const logoPathMap: Record<LogoStyle, string> = {
  8. default: '/logo/logo.svg',
  9. monochromeWhite: '/logo/logo-monochrome-white.svg',
  10. }
  11. export type LogoSize = 'large' | 'medium' | 'small'
  12. export const logoSizeMap: Record<LogoSize, string> = {
  13. large: 'w-16 h-7',
  14. medium: 'w-12 h-[22px]',
  15. small: 'w-9 h-4',
  16. }
  17. type DifyLogoProps = {
  18. style?: LogoStyle
  19. size?: LogoSize
  20. className?: string
  21. }
  22. const DifyLogo: FC<DifyLogoProps> = ({
  23. style = 'default',
  24. size = 'medium',
  25. className,
  26. }) => {
  27. const { theme } = useTheme()
  28. const themedStyle = (theme === 'dark' && style === 'default') ? 'monochromeWhite' : style
  29. return (
  30. <img
  31. src={`${basePath}${logoPathMap[themedStyle]}`}
  32. className={classNames('block object-contain', logoSizeMap[size], className)}
  33. alt='Dify logo'
  34. />
  35. )
  36. }
  37. export default DifyLogo