placeholder.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { Group } from '../../../base/icons/src/vender/other'
  2. import Title from './title'
  3. import { SkeletonContainer, SkeletonPoint, SkeletonRectangle, SkeletonRow } from '@/app/components/base/skeleton'
  4. import cn from '@/utils/classnames'
  5. type Props = {
  6. wrapClassName: string
  7. loadingFileName?: string
  8. }
  9. export const LoadingPlaceholder = ({ className }: { className?: string }) => (
  10. <div className={cn('h-2 rounded-sm opacity-20 bg-text-quaternary', className)} />
  11. )
  12. const Placeholder = ({
  13. wrapClassName,
  14. loadingFileName,
  15. }: Props) => {
  16. return (
  17. <div className={wrapClassName}>
  18. <SkeletonRow>
  19. <div
  20. className='flex w-10 h-10 p-1 justify-center items-center gap-2 rounded-[10px]
  21. border-[0.5px] border-components-panel-border bg-background-default backdrop-blur-sm'>
  22. <div className='flex w-5 h-5 justify-center items-center'>
  23. <Group className='text-text-tertiary' />
  24. </div>
  25. </div>
  26. <div className="grow">
  27. <SkeletonContainer>
  28. <div className="flex items-center h-5">
  29. {loadingFileName ? (
  30. <Title title={loadingFileName} />
  31. ) : (
  32. <SkeletonRectangle className="w-[260px]" />
  33. )}
  34. </div>
  35. <SkeletonRow className="h-4">
  36. <SkeletonRectangle className="w-[41px]" />
  37. <SkeletonPoint />
  38. <SkeletonRectangle className="w-[180px]" />
  39. </SkeletonRow>
  40. </SkeletonContainer>
  41. </div>
  42. </SkeletonRow>
  43. <SkeletonRectangle className="mt-3 w-[420px]" />
  44. </div>
  45. )
  46. }
  47. export default Placeholder