Skip to content

Commit d9858f5

Browse files
committed
Add skeleton to the filter
1 parent bb2ff77 commit d9858f5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

site/src/pages/WorkspacesPage/Filter.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import MenuList from "@mui/material/MenuList"
2020
import { useSearchParams } from "react-router-dom"
2121
import { useQuery } from "@tanstack/react-query"
2222
import { getUsers, getTemplates } from "api/api"
23+
import Skeleton, { SkeletonProps } from "@mui/material/Skeleton"
2324

2425
/** Filter */
2526

@@ -258,6 +259,20 @@ type StatusAutocomplete = ReturnType<typeof useStatusAutocomplete>
258259

259260
/** Components */
260261

262+
const FilterSkeleton = (props: SkeletonProps) => {
263+
return (
264+
<Skeleton
265+
variant="rectangular"
266+
height={36}
267+
{...props}
268+
sx={{
269+
bgcolor: (theme) => theme.palette.background.paperLight,
270+
borderRadius: "6px",
271+
}}
272+
/>
273+
)
274+
}
275+
261276
export const Filter = ({
262277
filter,
263278
autocomplete,
@@ -270,6 +285,21 @@ export const Filter = ({
270285
}
271286
}) => {
272287
const hasFilterQuery = filter.query !== ""
288+
const isIinitializingFilters =
289+
autocomplete.status.isInitializing ||
290+
autocomplete.templates.isInitializing ||
291+
autocomplete.users.isInitializing
292+
293+
if (isIinitializingFilters) {
294+
return (
295+
<Box display="flex" sx={{ gap: 1, mb: 2 }}>
296+
<FilterSkeleton width="100%" />
297+
<FilterSkeleton width={120} />
298+
<FilterSkeleton width={120} />
299+
<FilterSkeleton width={120} />
300+
</Box>
301+
)
302+
}
273303

274304
return (
275305
<Box display="flex" sx={{ gap: 1, mb: 2 }}>

0 commit comments

Comments
 (0)