Improve hero carousel #136 [2/-]
This commit is contained in:
3 files changed
+139
-46
No files matched your search
@@ -20,6 +20,7 @@ export const CarouselSkeleton = () => {
|
||||
sx={{
|
||||
width: "100vw",
|
||||
height: "100vh",
|
||||
position: "absolute",
|
||||
}}
|
||||
></Skeleton>
|
||||
</div>
|
||||
|
||||
@@ -43,6 +43,12 @@
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
opacity: 0.8;
|
||||
mask-image: linear-gradient(to bottom, black, transparent);
|
||||
-webkit-mask-image: linear-gradient(
|
||||
to bottom,
|
||||
black,
|
||||
transparent
|
||||
);
|
||||
}
|
||||
&-image {
|
||||
position: absolute;
|
||||
@@ -54,19 +60,6 @@
|
||||
bottom: 0;
|
||||
background-position: center;
|
||||
opacity: 1;
|
||||
&::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: linear-gradient(
|
||||
to top,
|
||||
rgb(0 0 0 / 0.45),
|
||||
transparent
|
||||
);
|
||||
}
|
||||
}
|
||||
&-icon {
|
||||
position: absolute;
|
||||
@@ -104,7 +97,7 @@
|
||||
z-index: 0;
|
||||
display: flex;
|
||||
height: 100%;
|
||||
width: 70%;
|
||||
width: 80%;
|
||||
padding: 2em;
|
||||
flex-direction: column;
|
||||
justify-content: flex-end;
|
||||
|
||||
+131
-32
@@ -52,6 +52,7 @@ import { BaseItemKind, ItemFields } from "@jellyfin/sdk/lib/generated-client";
|
||||
import { ErrorBoundary } from "react-error-boundary";
|
||||
import CarouselSlideError from "../../components/errors/carousel";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
const Home = () => {
|
||||
const authUser = useQuery({
|
||||
queryKey: ["home", "authenticateUser"],
|
||||
@@ -298,6 +299,7 @@ const Home = () => {
|
||||
sx={{
|
||||
marginBottom: "1.5em",
|
||||
}}
|
||||
duration={400}
|
||||
interval={10000}
|
||||
>
|
||||
{latestMedia.isLoading ? (
|
||||
@@ -318,10 +320,7 @@ const Home = () => {
|
||||
className="hero-carousel-slide"
|
||||
sx={{
|
||||
background:
|
||||
theme.palette
|
||||
.primary
|
||||
.background
|
||||
.dark,
|
||||
"transparent",
|
||||
}}
|
||||
key={index}
|
||||
>
|
||||
@@ -422,11 +421,30 @@ const Home = () => {
|
||||
</div>
|
||||
<Box className="hero-carousel-detail">
|
||||
<Typography
|
||||
component={
|
||||
motion.h2
|
||||
}
|
||||
key={item.Id}
|
||||
variant="h2"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
mb: 2.5,
|
||||
}}
|
||||
initial={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
exit={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.35,
|
||||
}}
|
||||
whileInView={{
|
||||
y: 0,
|
||||
opacity: 1,
|
||||
}}
|
||||
>
|
||||
{!item.ImageTags
|
||||
.Logo ? (
|
||||
@@ -449,16 +467,27 @@ const Home = () => {
|
||||
)}
|
||||
</Typography>
|
||||
<Stack
|
||||
// sx={{
|
||||
// display: "flex",
|
||||
// alignItems:
|
||||
// "center",
|
||||
// width: "fit-content",
|
||||
// gap: "1em",
|
||||
// mb: 1.5,
|
||||
// }}
|
||||
component={
|
||||
motion.div
|
||||
}
|
||||
direction="row"
|
||||
gap={1}
|
||||
initial={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
delay: 0.1,
|
||||
}}
|
||||
exit={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
whileInView={{
|
||||
y: 0,
|
||||
opacity: 1,
|
||||
}}
|
||||
divider={
|
||||
<Box
|
||||
sx={{
|
||||
@@ -474,13 +503,6 @@ const Home = () => {
|
||||
}}
|
||||
></Box>
|
||||
}
|
||||
// <Divider
|
||||
// variant="middle"
|
||||
// component="div"
|
||||
// orientation="vertical"
|
||||
// flexItem
|
||||
// />
|
||||
|
||||
className="hero-carousel-info"
|
||||
>
|
||||
<Typography
|
||||
@@ -547,6 +569,25 @@ const Home = () => {
|
||||
)}
|
||||
</Stack>
|
||||
<Typography
|
||||
component={
|
||||
motion.div
|
||||
}
|
||||
initial={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
delay: 0.2,
|
||||
}}
|
||||
whileInView={{
|
||||
y: 0,
|
||||
opacity: 1,
|
||||
}}
|
||||
exit={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
variant="subtitle1"
|
||||
className="hero-carousel-text"
|
||||
sx={{
|
||||
@@ -560,7 +601,7 @@ const Home = () => {
|
||||
overflow:
|
||||
"hidden",
|
||||
WebkitLineClamp:
|
||||
"3",
|
||||
"4",
|
||||
WebkitBoxOrient:
|
||||
"vertical",
|
||||
opacity: 0.7,
|
||||
@@ -572,23 +613,81 @@ const Home = () => {
|
||||
{item.UserData
|
||||
.PlaybackPositionTicks >
|
||||
0 && (
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
item
|
||||
.UserData
|
||||
.PlayedPercentage
|
||||
<Stack
|
||||
component={
|
||||
motion.div
|
||||
}
|
||||
color="white"
|
||||
sx={{
|
||||
mt: 2,
|
||||
borderRadius: 1,
|
||||
width: "50%",
|
||||
initial={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
/>
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
delay: 0.3,
|
||||
}}
|
||||
whileInView={{
|
||||
y: 0,
|
||||
opacity: 1,
|
||||
}}
|
||||
exit={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
direction="row"
|
||||
gap="1em"
|
||||
mt={2}
|
||||
width="50%"
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
>
|
||||
<Typography
|
||||
variant="subtitle1"
|
||||
whiteSpace="nowrap"
|
||||
>
|
||||
{getRuntime(
|
||||
item.RunTimeTicks -
|
||||
item
|
||||
.UserData
|
||||
.PlaybackPositionTicks,
|
||||
)}{" "}
|
||||
</Typography>
|
||||
<LinearProgress
|
||||
variant="determinate"
|
||||
value={
|
||||
item
|
||||
.UserData
|
||||
.PlayedPercentage
|
||||
}
|
||||
color="white"
|
||||
sx={{
|
||||
borderRadius: 1,
|
||||
height: "2.5px",
|
||||
width: "100%",
|
||||
}}
|
||||
/>
|
||||
</Stack>
|
||||
)}
|
||||
{/* TODO Link PLay and More info buttons in carousel */}
|
||||
<Box
|
||||
component={
|
||||
motion.div
|
||||
}
|
||||
initial={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
transition={{
|
||||
duration: 0.25,
|
||||
delay: 0.4,
|
||||
}}
|
||||
whileInView={{
|
||||
y: 0,
|
||||
opacity: 1,
|
||||
}}
|
||||
exit={{
|
||||
y: 10,
|
||||
opacity: 0,
|
||||
}}
|
||||
sx={{
|
||||
display: "flex",
|
||||
gap: 3,
|
||||
|
||||
Reference in new issue
Block a user