Add UpNext Section and Skeleton for card sections

This commit is contained in:
prayag17 committed 2023-03-24 09:37:51 +05:30
1 parent 8d00739199
commit 3d40912b6f
2 files changed
+51 -4

No files matched your search

+22
View File
@@ -0,0 +1,22 @@
/** @format */
import Skeleton from "@mui/material/Skeleton";
import Card from "@mui/material/Card";
import CardContent from "@mui/material/CardContent";
import CardMedia from "@mui/material/CardMedia";
import CardActionArea from "@mui/material/CardActionArea";
import Typography from "@mui/material/Typography";
import Box from "@mui/material/Box";
export const CardsSkeleton = () => {
return (
<Box sx={{ display: "flex", flexFlow: "column", mb: 4 }}>
<Typography variant="h4" sx={{ mb: "0.15em" }}>
<Skeleton width="35%" animation="wave" />
</Typography>
<Skeleton width="100%" variant="rounded" animation="wave">
<div style={{ paddingTop: "20%" }}></div>
</Skeleton>
</Box>
);
};
+29 -4
View File
@@ -48,6 +48,7 @@ import { useNavigate } from "react-router-dom";
import { formateDate } from "../../utils/date/formateDate";
import { getRuntime } from "../../utils/date/time";
import { CarouselSkeleton } from "../../components/skeleton/carousel";
import { CardsSkeleton } from "../../components/skeleton/cards";
const Home = () => {
const queryClient = useQueryClient();
@@ -513,9 +514,9 @@ const Home = () => {
})
)}
</Carousel>
<CardScroller displayCards={4} title={"Libraries"}>
<CardScroller displayCards={4} title="Libraries">
{libraries.isLoading ? (
<>"loading...</>
<CardsSkeleton />
) : (
libraries.data.Items.map((item, index) => {
return (
@@ -533,9 +534,33 @@ const Home = () => {
})
)}
</CardScroller>
{upNextItems.isLoading ? (
<CardsSkeleton />
) : upNextItems.data.Items.length == 0 ? (
<></>
) : (
<CardScroller displayCards={4} title="Up Next">
{upNextItems.data.Items.map(
(item, index) => {
return (
<CardLandscape
key={index}
itemName={item.Name}
itemId={item.Id}
// imageTags={false}
imageTags={
!!item.ImageTags
.Primary
}
iconType={item.Type}
></CardLandscape>
);
},
)}
</CardScroller>
)}
{/* <Box className="home-section">
<Typography
<Typography
variant="h4"
color="textPrimary"
className="home-section-heading"