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