Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat / Hero and HeroShelf improvements #642

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions packages/ui-react/src/components/Card/Card.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
position: relative;
z-index: 1;
outline: none !important;
box-shadow: none !important;
transform: scale(1.05);

& .poster {
box-shadow: 0 0 0 3px var(--highlight-color, variables.$white), 0 8px 10px rgb(0 0 0 / 14%), 0 3px 14px rgb(0 0 0 / 12%), 0 4px 5px rgb(0 0 0 / 20%);
}
}
}

Expand Down Expand Up @@ -67,10 +62,6 @@
&:hover {
transform: scale(1);
cursor: default;

& .poster {
box-shadow: none;
}
}
}
}
Expand All @@ -84,8 +75,6 @@
background-position: center;
background-size: cover;
border-radius: 4px;
box-shadow: 0 8px 10px rgb(0 0 0 / 14%), 0 3px 14px rgb(0 0 0 / 12%), 0 4px 5px rgb(0 0 0 / 20%);
transition: box-shadow 0.1s ease;

&.current::after {
position: absolute;
Expand Down
5 changes: 3 additions & 2 deletions packages/ui-react/src/components/Hero/Hero.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}

.poster {
position: absolute;
position: fixed;
top: 0;
right: 0;
z-index: -1;
Expand All @@ -41,13 +41,14 @@
max-height: 700px;
object-fit: cover;
object-position: center 30%;
transition: opacity ease-out 0.3s;

-webkit-mask-image: radial-gradient(farthest-corner at 80% 30%, rgba(0, 0, 0, 0.8) 20%, rgb(0 0 0 / 21%) 45%, rgb(0 0 0 / 0%) 73%);
mask-image: radial-gradient(farthest-corner at 80% 30%, rgba(0, 0, 0, 0.8) 20%, rgb(0 0 0 / 21%) 45%, rgb(0 0 0 / 0%) 73%);
}

.posterFade {
position: absolute;
position: fixed;
top: 0;
right: 0;
left: 0;
Expand Down
13 changes: 11 additions & 2 deletions packages/ui-react/src/components/Hero/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React, { type PropsWithChildren } from 'react';
import React, { useRef, type PropsWithChildren } from 'react';

import Image from '../Image/Image';
import { useScrolledDown } from '../../hooks/useScrolledDown';
import useBreakpoint, { Breakpoint } from '../../hooks/useBreakpoint';

import styles from './Hero.module.scss';

Expand All @@ -10,10 +12,17 @@ type Props = PropsWithChildren<{

const Hero = ({ image, children }: Props) => {
const alt = ''; // intentionally empty for a11y, because adjacent text alternative
const posterRef = useRef<HTMLImageElement>(null);
const breakpoint = useBreakpoint();
const isMobile = breakpoint <= Breakpoint.sm;

useScrolledDown(50, isMobile ? 150 : 500, (progress: number) => {
if (posterRef.current) posterRef.current.style.opacity = `${Math.max(1 - progress, 0.1)}`;
});

return (
<div className={styles.hero}>
<Image className={styles.poster} image={image} width={1280} alt={alt} />
<Image ref={posterRef} className={styles.poster} image={image} width={1280} alt={alt} />
<div className={styles.posterFade} />
<div className={styles.info}>{children}</div>
</div>
Expand Down
36 changes: 20 additions & 16 deletions packages/ui-react/src/components/HeroShelf/HeroShelf.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ $desktop-max-height: 700px;
$desktop-min-height: 275px;

$tablet-height: 70vw;
$tablet-min-height: 375px;
$tablet-min-height: 550px;

$mobile-height: 70vh;
$mobile-min-height: 450px;
Expand Down Expand Up @@ -47,12 +47,13 @@ $mobile-landscape-height: 100vh;
}

@include responsive.mobile-only() {
height: calc($mobile-height - variables.$header-height - var(--safe-area-top, 0));
height: calc($mobile-height - variables.$header-height - var(--safe-area-top, 0px));
min-height: calc($mobile-min-height - variables.$header-height);
}

@include responsive.mobile-only-landscape() {
height: calc($mobile-landscape-height - variables.$header-height);
min-height: initial;
padding: 0;
}
}
Expand Down Expand Up @@ -97,6 +98,7 @@ $mobile-landscape-height: 100vh;
height: 56.25vw;
max-height: 700px;
background-color: var(--hero-shelf-background-color);
transition: opacity ease-out 0.3s;
royschut marked this conversation as resolved.
Show resolved Hide resolved

@include responsive.tablet-only() {
height: $tablet-height;
Expand All @@ -106,22 +108,15 @@ $mobile-landscape-height: 100vh;
@include responsive.mobile-only() {
height: $mobile-height;
min-height: $mobile-min-height;
margin-top: var(--safe-area-top, 0);
}

@include responsive.mobile-only-landscape() {
height: $mobile-landscape-height;
min-height: initial;
}
}

.undimmed {
opacity: 1;
transition: opacity ease-out 0.3s;
}

.dimmed {
opacity: 0.01;
}

.background {
position: absolute;
top: 0;
Expand All @@ -145,13 +140,13 @@ $mobile-landscape-height: 100vh;
}

@include responsive.tablet-small-only() {
-webkit-mask-image: linear-gradient(190deg, black, rgba(0, 0, 0, 0.8) 40%, transparent 90%);
mask-image: linear-gradient(190deg, black, rgba(0, 0, 0, 0.8) 40%, transparent 90%);
-webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0, 0, 0, 1) 30%, transparent 90%);
mask-image: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0, 0, 0, 1) 30%, transparent 90%);
}

@include responsive.mobile-only() {
-webkit-mask-image: linear-gradient(190deg, black, rgba(0, 0, 0, 0.8) 40%, transparent 85%);
mask-image: linear-gradient(190deg, black, rgba(0, 0, 0, 0.8) 40%, transparent 85%);
-webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0, 0, 0, 1) 30%, transparent 75%);
mask-image: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0, 0, 0, 1) 30%, transparent 75%);
}
}

Expand Down Expand Up @@ -184,7 +179,14 @@ $mobile-landscape-height: 100vh;
}
}

.metadataMobile {
.swipeSlider {
display: flex;
align-items: flex-end;
width: 100%;
height: 100%;
}

.swipeSliderMobile {
width: 100%;
height: 100%;
}
Expand All @@ -194,6 +196,7 @@ $mobile-landscape-height: 100vh;
display: flex;
flex-direction: column;
gap: 24px;
width: 46%;
max-width: 46%;
padding-left: calc(variables.$base-spacing * 4);

Expand Down Expand Up @@ -231,6 +234,7 @@ $mobile-landscape-height: 100vh;

@include responsive.mobile-only-landscape() {
max-width: 70%;
min-height: initial;
padding: 0 calc(variables.$base-spacing * 3) calc(variables.$base-spacing * 3) calc(variables.$base-spacing * 3);
}

Expand Down
Loading
Loading