index.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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('grow relative h-0 flex flex-wrap p-2 overflow-hidden', className)}
  22. >
  23. {
  24. Array.from({ length: 16 }).map((_, index) => (
  25. <div
  26. key={index}
  27. className={cn(
  28. 'mr-3 mb-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 bg-marketplace-plugin-empty z-[1]'
  41. ></div>
  42. )
  43. }
  44. <div className='absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-[2] flex flex-col items-center'>
  45. <div className='relative flex items-center justify-center mb-3 w-14 h-14 rounded-xl border border-dashed border-divider-deep bg-components-card-bg shadow-lg'>
  46. <Group className='w-5 h-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 top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 rotate-90' />
  50. <Line className='absolute top-full left-1/2 -translate-x-1/2 -translate-y-1/2 rotate-90' />
  51. </div>
  52. <div className='text-center system-md-regular text-text-tertiary'>
  53. {text || t('plugin.marketplace.noPluginFound')}
  54. </div>
  55. </div>
  56. </div>
  57. )
  58. }
  59. export default Empty