refactor: move more components to ts

This commit is contained in:
Prayag Prajapati committed 2024-12-03 19:01:17 +05:30
1 parent e049ce9ad6
commit 97526e29b4
12 files changed
+180 -267

No files matched your search

-26
View File
@@ -1,26 +0,0 @@
import Box from "@mui/material/Box";
import Card from "@mui/material/Card";
import CardActionArea from "@mui/material/CardActionArea";
import CardContent from "@mui/material/CardContent";
import CardMedia from "@mui/material/CardMedia";
import Skeleton from "@mui/material/Skeleton";
import Typography from "@mui/material/Typography";
export const CardsSkeleton = () => {
return (
<div
style={{
display: "flex",
flexFlow: "column",
marginBottom: "2em",
}}
>
<Typography variant="h4" sx={{ mb: "0.15em" }}>
<Skeleton width="35%" animation="wave" />
</Typography>
<Skeleton width="100%" variant="rounded" animation="wave">
<div style={{ paddingTop: "20%" }} />
</Skeleton>
</div>
);
};
+34
View File
@@ -0,0 +1,34 @@
import Skeleton from "@mui/material/Skeleton";
import Typography from "@mui/material/Typography";
import React from "react";
export const CardsSkeleton = () => {
return (
<div
style={{
display: "flex",
flexFlow: "column",
marginBottom: "2em",
}}
>
<Typography variant="h3" sx={{ mb: "0.15em" }}>
<Skeleton width="35%" />
</Typography>
<div className="flex flex-align-center" style={{ height: "17em" }}>
{Array.from({ length: 12 }).map((_, index) => (
<Skeleton
height="26em"
sx={{
flex: "1 0 12.45%",
marginRight: "1.5em",
borderRadius: "10px",
animationDelay: `${index * 0.25}s`,
}}
// biome-ignore lint/suspicious/noArrayIndexKey: This is a skeleton component
key={index}
/>
))}
</div>
</div>
);
};
@@ -1,22 +1,15 @@
import Box from "@mui/material/Box";
import Paper from "@mui/material/Paper";
import Skeleton from "@mui/material/Skeleton";
import Typography from "@mui/material/Typography";
import React from "react";
import { theme } from "../../theme";
export const CarouselSkeleton = () => {
return (
<Paper
className="hero-carousel-skeleton"
elevation={0}
sx={{
<div
className="hero-carousel hero-carousel-skeleton"
style={{
height: "70vh",
marginBottom: "3.2em",
position: "relative",
background: "black",
border: "1px solid rgb(255 255 255 / 0.2)",
borderRadius: "10px",
overflow: "hidden",
width: "100vw",
marginLeft: "-4.4em",
}}
>
<div className="hero-carousel-detail">
@@ -29,9 +22,13 @@ export const CarouselSkeleton = () => {
/>
</Typography>
<Typography
variant="p"
variant="body1"
className="hero-carousel-text"
style={{ display: "flex", flexDirection: "column" }}
style={{
display: "flex",
flexDirection: "column",
paddingBottom: "4.4em",
}}
>
<Skeleton
variant="text"
@@ -53,6 +50,6 @@ export const CarouselSkeleton = () => {
/>
</Typography>
</div>
</Paper>
</div>
);
};
+90 -60
View File
@@ -2,66 +2,96 @@ import { Divider, Skeleton, Typography } from "@mui/material";
import React from "react";
const EpisodeSkeleton = () => {
return Array.from(new Array(8)).map((a, index) => {
return <>
<div
key={index}
style={{
width: "100%",
}}
className="item-detail-episode"
>
<Typography variant="h6"><Skeleton variant="circular" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} /></Typography>
<div className="item-detail-episode-image-container">
<Skeleton className="item-detail-episode-image" variant="rectangular" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
</div>
<div className="item-detail-episode-info">
<Typography variant="h4">
<Skeleton variant="text" width="10em" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
</Typography>
<Skeleton variant="rounded" width="5em" style={{ borderRadius: "100px" }} sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
<Typography style={{
width: "100%"
}}>
<Skeleton width="100%" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
<Skeleton width="100%" sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}} />
</Typography>
</div>
</div>
{index !== 7 && <Divider orientation="horizontal" flexItem />}
</>
})
return Array.from(new Array(8)).map((_, index) => {
return (
<div
// biome-ignore lint/suspicious/noArrayIndexKey: this is a skeleton
key={index}
style={{
width: "100%",
}}
>
<div className="item-detail-episode">
<Typography variant="h6">
<Skeleton
variant="circular"
sx={{
animationDelay: `${index * 0.25}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
aspectRatio: 1,
width: "3rem",
height: "3rem",
}}
/>
</Typography>
<div className="item-detail-episode-image-container">
<Skeleton
className="item-detail-episode-image"
variant="rectangular"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
</div>
<div className="item-detail-episode-info">
<Typography variant="h4">
<Skeleton
variant="text"
width="10em"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
</Typography>
<Skeleton
variant="rounded"
width="5em"
style={{ borderRadius: "100px" }}
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
<Typography
style={{
width: "100%",
}}
>
<Skeleton
width="100%"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
<Skeleton
width="100%"
sx={{
animationDelay: `${index * 0.2}s`,
animationDuration: "1.4s",
animationName: "pulse",
opacity: 0.1,
}}
/>
</Typography>
</div>
</div>
{index !== 7 && <Divider orientation="horizontal" flexItem />}
</div>
);
});
}
export default EpisodeSkeleton
-59
View File
@@ -1,59 +0,0 @@
import Card from "@mui/material/Card";
import CardContent from "@mui/material/CardContent";
import CardMedia from "@mui/material/CardMedia";
import Skeleton from "@mui/material/Skeleton";
import Typography from "@mui/material/Typography";
import Grid from "@mui/material/Unstable_Grid2";
export const EpisodeCardsSkeleton = () => {
return (
<Grid
container
columns={{
xs: 2,
sm: 3,
md: 4,
}}
sx={{ width: "100%" }}
>
{Array.from(new Array(4)).map((a) => {
return (
<Grid xs={1} sm={1} md={1} key={a}>
<Card sx={{ background: "transparent" }} elevation={0}>
<CardMedia>
<Skeleton
animation="wave"
variant="rectangular"
sx={{
aspectRatio: "1.777",
height: "auto",
m: 1,
borderRadius: "8px",
}}
/>
</CardMedia>
<CardContent
sx={{
padding: "0 0.5em",
alignItems: "flex-start",
backgroundColor: "transparent",
}}
>
<Typography variant="h6">
<Skeleton variant="text" animation="wave" />
</Typography>
<Typography variant="body2">
<Skeleton variant="text" animation="wave" />
<Skeleton variant="text" animation="wave" />
<Skeleton variant="text" animation="wave" />
</Typography>
</CardContent>
</Card>
</Grid>
);
})}
</Grid>
);
};
@@ -1,12 +1,13 @@
import Divider from "@mui/material/Divider";
import Grid from "@mui/material/Grid2";
import Grid2 from "@mui/material/Grid2";
import Skeleton from "@mui/material/Skeleton";
import Typography from "@mui/material/Typography";
import React from "react";
import EpisodeSkeleton from "./episode";
export const SeasonSelectorSkeleton = () => {
return (
<Grid
<Grid2
container
columns={{
xs: 2,
@@ -44,8 +45,8 @@ export const SeasonSelectorSkeleton = () => {
}}
/>
<div className="item-detail-episode-container">
<EpisodeSkeleton/>
<EpisodeSkeleton />
</div>
</Grid>
</Grid2>
);
};