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 bg-text-quaternary opacity-20', className)} />
  11. )
  12. const Placeholder = ({
  13. wrapClassName,
  14. loadingFileName,
  15. }: Props) => {
  16. return (
  17. <div className={wrapClassName}>
  18. <SkeletonRow>
  19. <div
  20. className='flex h-10 w-10 items-center justify-center gap-2 rounded-[10px] border-[0.5px]
  21. border-components-panel-border bg-background-default p-1 backdrop-blur-sm'>
  22. <div className='flex h-5 w-5 items-center justify-center'>
  23. <Group className='text-text-tertiary' />
  24. </div>
  25. </div>
  26. <div className="grow">
  27. <SkeletonContainer>
  28. <div className="flex h-5 items-center">
  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