From e2ebbd447150e13aff6863853d6a6ed618dc712c Mon Sep 17 00:00:00 2001 From: Prayag Prajapati Date: Sun, 13 Aug 2023 21:22:09 +0530 Subject: [PATCH] Improve hero carousel [1/-] #136 --- src/App.jsx | 7 +- src/components/skeleton/carousel.jsx | 6 +- src/routes/home/home.module.scss | 53 ++- src/routes/home/index.jsx | 603 +++++++++++++++------------ src/styles/global.scss | 4 +- 5 files changed, 371 insertions(+), 302 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 312e68f..20ac99e 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -356,7 +356,12 @@ function App() { -
+
diff --git a/src/components/skeleton/carousel.jsx b/src/components/skeleton/carousel.jsx index 244a68f..e99b303 100644 --- a/src/components/skeleton/carousel.jsx +++ b/src/components/skeleton/carousel.jsx @@ -9,7 +9,7 @@ export const CarouselSkeleton = () => {
@@ -17,6 +17,10 @@ export const CarouselSkeleton = () => { variant="rectangular" height="100%" animation="wave" + sx={{ + width: "100vw", + height: "100vh", + }} >
diff --git a/src/routes/home/home.module.scss b/src/routes/home/home.module.scss index 4c9e57a..13fb0af 100644 --- a/src/routes/home/home.module.scss +++ b/src/routes/home/home.module.scss @@ -1,5 +1,4 @@ /** @format */ - .home { &-background { &-container { @@ -23,8 +22,8 @@ isolation: isolate; &-slide { position: relative; - height: 70vh; - border-radius: 10px !important; + height: 100%; + border-radius: 0px !important; overflow: hidden; margin: 0 auto; } @@ -34,6 +33,7 @@ height: 100%; position: absolute; z-index: 1; + filter: brightness(0.7); } &-container { position: absolute; @@ -42,16 +42,7 @@ left: 0; right: 0; bottom: 0; - mask-image: linear-gradient( - to right, - rgba(0, 0, 0, 0.1), - black 90% - ); - -webkit-mask-image: linear-gradient( - to right, - rgba(0, 0, 0, 0.1), - black 90% - ); + opacity: 0.8; } &-image { position: absolute; @@ -63,18 +54,19 @@ bottom: 0; background-position: center; opacity: 1; - mask-image: linear-gradient( - to right, - transparent 2%, - rgba(0, 0, 0, 0.5) 20%, - black 70% - ); - -webkit-mask-image: linear-gradient( - to right, - transparent 2%, - rgba(0, 0, 0, 0.5) 20%, - black 70% - ); + &::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; @@ -111,14 +103,21 @@ position: relative; z-index: 0; display: flex; - height: 70vh; + height: 100%; width: 70%; padding: 2em; flex-direction: column; - justify-content: center; + justify-content: flex-end; align-items: flex-start; + padding-bottom: 5em; } &-indicator { + &-container { + width: calc(100% - 2em) !important; + margin-top: -1em !important; + margin-left: 1em !important; + margin-right: 1em !important; + } width: 100%; height: 5px; border-radius: 0; diff --git a/src/routes/home/index.jsx b/src/routes/home/index.jsx index 9aea619..bde15e5 100644 --- a/src/routes/home/index.jsx +++ b/src/routes/home/index.jsx @@ -18,7 +18,7 @@ import Button from "@mui/material/Button"; import Paper from "@mui/material/Paper"; import Typography from "@mui/material/Typography"; import Chip from "@mui/material/Chip"; -import Divider from "@mui/material/Divider"; +import LinearProgress from "@mui/material/LinearProgress"; import Stack from "@mui/material/Stack"; import { yellow } from "@mui/material/colors"; @@ -204,11 +204,9 @@ const Home = () => { <> { */}
} @@ -289,9 +287,12 @@ const Home = () => { }, }} indicatorContainerProps={{ + className: "hero-carousel-indicator-container", style: { + position: "absolute", display: "flex", gap: "1em", + zIndex: 1, }, }} sx={{ @@ -421,7 +422,7 @@ const Home = () => {
{ direction="row" gap={1} divider={ - + } + // + className="hero-carousel-info" > { > {item.Overview} + + {item.UserData + .PlaybackPositionTicks > + 0 && ( + + )} {/* TODO Link PLay and More info buttons in carousel */} { }) )} - {libraries.isLoading ? ( - - ) : ( - - {libraries.status == "success" && - libraries.data.Items.map((item, index) => { - return ( - { - navigate( - `/library/${item.Id}`, - ); - }} - blurhash={ - item.ImageBlurHashes == - {} - ? "" - : !!item.ImageTags + + {libraries.isLoading ? ( + + ) : ( + + {libraries.status == "success" && + libraries.data.Items.map( + (item, index) => { + return ( + { + navigate( + `/library/${item.Id}`, + ); + }} + blurhash={ + item.ImageBlurHashes == + {} + ? "" + : !!item .ImageTags .Primary - ] - : "" - : "" - } - currentUser={user.data} - > - ); - })} - - )} - {upNextItems.isLoading ? ( - - ) : upNextItems.isSuccess && - upNextItems.data.Items.length == 0 ? ( - <> - ) : ( - - {upNextItems.data.Items.map((item, index) => { - return ( - + ); + }, + )} + + )} + {upNextItems.isLoading ? ( + + ) : upNextItems.isSuccess && + upNextItems.data.Items.length == 0 ? ( + <> + ) : ( + + {upNextItems.data.Items.map( + (item, index) => { + return ( + - ); - })} - - )} - {resumeItemsVideo.isLoading ? ( - - ) : resumeItemsVideo.data.Items.length == 0 ? ( - <> - ) : ( - - {resumeItemsVideo.data.Items.map( - (item, index) => { - return ( - - ); - }, - )} - - )} - {resumeItemsAudio.isLoading ? ( - - ) : resumeItemsAudio.data.Items.length == 0 ? ( - <> - ) : ( - - {resumeItemsAudio.data.Items.map( - (item, index) => { - return ( - + ); + }, + )} + + )} + {resumeItemsVideo.isLoading ? ( + + ) : resumeItemsVideo.data.Items.length == 0 ? ( + <> + ) : ( + + {resumeItemsVideo.data.Items.map( + (item, index) => { + return ( + - ); - }, - )} - - )} - {latestMediaLibs.map((lib, index) => { - return ( - - ); - })} - + } + currentUser={user.data} + favourite={ + item.UserData + .IsFavorite + } + > + ); + }, + )} + + )} + {resumeItemsAudio.isLoading ? ( + + ) : resumeItemsAudio.data.Items.length == 0 ? ( + <> + ) : ( + + {resumeItemsAudio.data.Items.map( + (item, index) => { + return ( + + ); + }, + )} + + )} + {latestMediaLibs.map((lib, index) => { + return ( + + ); + })} + ); diff --git a/src/styles/global.scss b/src/styles/global.scss index f041c22..9ad0706 100644 --- a/src/styles/global.scss +++ b/src/styles/global.scss @@ -16,7 +16,7 @@ div::-webkit-scrollbar { ::-webkit-scrollbar-track { background-color: transparent; &:hover { - background-color: rgb(255 255 255 / 0.15); + background-color: rgb(255 255 255 / 0.1); } } ::-webkit-scrollbar-thumb { @@ -25,7 +25,7 @@ div::-webkit-scrollbar { border-radius: 9999px; background-color: rgb(255 255 255 / 0.25); &:hover { - background-color: rgb(255 255 255 / 0.35); + background-color: rgb(255 255 255 / 0.45); } }