FPSMS-frontend
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 

91 строка
2.7 KiB

  1. "use client";
  2. import Box from "@mui/material/Box";
  3. import Skeleton from "@mui/material/Skeleton";
  4. import Stack from "@mui/material/Stack";
  5. import { useTheme } from "@mui/material/styles";
  6. // Placeholder row count for first-load skeleton (layout only; unrelated to `PO_WORKBENCH_LIST_PAGE_SIZE`).
  7. const SKELETON_PLACEHOLDER_ROW_COUNT = 8;
  8. const ROW_SHELL_SX = {
  9. pt: 1.25,
  10. pb: 1,
  11. px: 2,
  12. borderBottom: 1,
  13. borderColor: "divider",
  14. borderLeftStyle: "solid",
  15. borderLeftWidth: 10,
  16. borderLeftColor: "transparent",
  17. } as const;
  18. function SearchResultRowSkeleton() {
  19. const theme = useTheme();
  20. const body1Skeleton = {
  21. fontSize: theme.typography.body1.fontSize,
  22. lineHeight: theme.typography.body1.lineHeight,
  23. };
  24. const body2Skeleton = {
  25. fontSize: theme.typography.body2.fontSize,
  26. lineHeight: theme.typography.body2.lineHeight,
  27. };
  28. return (
  29. <Box sx={ROW_SHELL_SX} aria-hidden>
  30. <Stack spacing={0.25} sx={{ minWidth: 0, width: "100%" }}>
  31. <Stack
  32. direction="row"
  33. alignItems="center"
  34. justifyContent="space-between"
  35. spacing={1}
  36. sx={{ minWidth: 0 }}
  37. >
  38. <Skeleton variant="text" width="min(200px, 55%)" sx={body1Skeleton} />
  39. <Stack direction="row" spacing={0.5} flexShrink={0}>
  40. <Skeleton
  41. variant="rounded"
  42. width={72}
  43. height={26}
  44. sx={{ borderRadius: 1 }}
  45. />
  46. <Skeleton
  47. variant="rounded"
  48. width={80}
  49. height={26}
  50. sx={{ borderRadius: 1 }}
  51. />
  52. </Stack>
  53. </Stack>
  54. <Skeleton variant="text" width="min(160px, 70%)" sx={body2Skeleton} />
  55. <Stack
  56. direction="row"
  57. spacing={2}
  58. flexWrap="wrap"
  59. useFlexGap
  60. sx={{ pt: 0.25 }}
  61. >
  62. <Stack direction="row" spacing={0.75} alignItems="center">
  63. <Skeleton variant="circular" width={16} height={16} />
  64. <Skeleton variant="text" width={88} sx={body2Skeleton} />
  65. </Stack>
  66. <Stack direction="row" spacing={0.75} alignItems="center">
  67. <Skeleton variant="circular" width={16} height={16} />
  68. <Skeleton variant="text" width={88} sx={body2Skeleton} />
  69. </Stack>
  70. </Stack>
  71. </Stack>
  72. </Box>
  73. );
  74. }
  75. /** Placeholder rows while the first `/po/list` page is loading (matches list row layout). */
  76. export default function PoWorkbenchSearchResultsListSkeleton() {
  77. return (
  78. <Box role="status" aria-busy="true" sx={{ width: "100%" }}>
  79. {Array.from({ length: SKELETON_PLACEHOLDER_ROW_COUNT }, (_, i) => (
  80. <SearchResultRowSkeleton key={i} />
  81. ))}
  82. </Box>
  83. );
  84. }