index.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. 'use client'
  2. import { Group } from '@/app/components/base/icons/src/vender/other'
  3. import Line from './line'
  4. import cn from '@/utils/classnames'
  5. import { useMixedTranslation } from '@/app/components/plugins/marketplace/hooks'
  6. type Props = {
  7. text?: string
  8. lightCard?: boolean
  9. className?: string
  10. locale?: string
  11. }
  12. const Empty = ({
  13. text,
  14. lightCard,
  15. className,
  16. locale,
  17. }: Props) => {
  18. const { t } = useMixedTranslation(locale)
  19. return (
  20. <div
  21. className={cn('relative flex h-0 grow flex-wrap overflow-hidden p-2', className)}
  22. >
  23. {
  24. Array.from({ length: 16 }).map((_, index) => (
  25. <div
  26. key={index}
  27. className={cn(
  28. 'mb-3 mr-3 h-[144px] w-[calc((100%-36px)/4)] rounded-xl bg-background-section-burn',
  29. index % 4 === 3 && 'mr-0',
  30. index > 11 && 'mb-0',
  31. lightCard && 'bg-background-default-lighter opacity-75',
  32. )}
  33. >
  34. </div>
  35. ))
  36. }
  37. {
  38. !lightCard && (
  39. <div
  40. className='absolute inset-0 z-[1] bg-marketplace-plugin-empty'
  41. ></div>
  42. )
  43. }
  44. <div className='absolute left-1/2 top-1/2 z-[2] flex -translate-x-1/2 -translate-y-1/2 flex-col items-center'>
  45. <div className='relative mb-3 flex h-14 w-14 items-center justify-center rounded-xl border border-dashed border-divider-deep bg-components-card-bg shadow-lg'>
  46. <Group className='h-5 w-5' />
  47. <Line className='absolute right-[-1px] top-1/2 -translate-y-1/2' />
  48. <Line className='absolute left-[-1px] top-1/2 -translate-y-1/2' />
  49. <Line className='absolute left-1/2 top-0 -translate-x-1/2 -translate-y-1/2 rotate-90' />
  50. <Line className='absolute left-1/2 top-full -translate-x-1/2 -translate-y-1/2 rotate-90' />
  51. </div>
  52. <div className='system-md-regular text-center text-text-tertiary'>
  53. {text || t('plugin.marketplace.noPluginFound')}
  54. </div>
  55. </div>
  56. </div>
  57. )
  58. }
  59. export default Empty