Skip to content

Commit

Permalink
feat: landing page redesign
Browse files Browse the repository at this point in the history
  • Loading branch information
jeangovil committed Jun 28, 2023
1 parent be12ed1 commit c6eb842
Show file tree
Hide file tree
Showing 18 changed files with 219 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@
}
}

@include utils.responsive('md', 'up') {
.mdx-cta-section:not(.mdx-cta-section--with-description) {
.mdx-cta-section__title {
max-width: 65%;
}
.mdx-cta-section:not(.mdx-cta-section--with-description) {
.mdx-cta-section__title {
max-width: 886px;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.mdx-hero {
position: relative;
display: flex;
flex-direction: column;
height: calc(100vh - var(--ifm-navbar-height) - 8px);
}

.mdx-hero--large {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
flex-direction: row;
align-items: center;
justify-content: stretch;
z-index: 0;

& > * {
flex-basis: 50%;
}

> a,
> a > button {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Typography, TypographyProps } from '@acid-info/lsd-react'
import clsx from 'clsx'
import React from 'react'
import './HeroActions.scss'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,28 @@
z-index: -2;
font-weight: 100 !important;
text-shadow: 1px 1px 6px rgba(var(--lsd-surface-primary), 1);

opacity: 0.7;
line-height: 2.3rem !important;
max-width: 1280px;
margin-top: 18px;
}

.mdx-hero-description--small {
//margin-top: 1rem;
@include lsd.typography('h6');
max-width: 1200px;
}

.mdx-hero-description--large {
@include lsd.typography('h4');
}

.mdx-hero-description--medium {
@include lsd.typography('h3');
}

@include utils.responsive('lg', 'down') {
.mdx-hero-description {
margin-top: 12px;
@include lsd.typography('subtitle1');
}

.mdx-hero-description--large {
//font-size: 1.875rem !important;
//line-height: 2.25rem !important;
//text-transform: uppercase;
}

.mdx-hero-description--medium {
@include lsd.typography('subtitle1');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const HeroDescription: React.FC<HeroDescriptionProps> = ({

return (
<Typography
variant={size === 'small' ? 'h5' : 'h2'}
variant={'h5'}
className={clsx(
className,
'mdx-hero-description',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
@use '../../../css/utils';

.mdx-hero-info {
padding: var(--logos-hero-info-padding-bottom) 0
var(--logos-hero-info-padding-bottom) 0;
height: var(--logos-hero-info-height);
padding: 32px 0;

display: flex;
flex-direction: column;
justify-content: end;

border-bottom: 1px solid rgb(var(--lsd-surface-secondary));
margin-bottom: calc(100vh - var(--logos-hero-info-height));

transition: margin-bottom 0.05s ease-in-out;
}

.mdx-hero-info--large {
}

@include utils.responsive('lg', 'down') {
:root {
//--logos-hero-info-height: 340px;
.mdx-hero-info {
padding: 24px 0;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import clsx from 'clsx'
import React, { PropsWithChildren, useEffect } from 'react'
import React, { PropsWithChildren } from 'react'
import { useHero } from '../Hero/Hero.context'
import { ScrollToBottom } from '../index'
import './HeroInfo.scss'
import { useScrollY } from '../../../lib/useScrollY'
import {
calcHeroInfoMb,
calcScrollThreshold,
isMobile,
mapFloat,
} from '../../../lib/ui.utils'

export type HeroInfoProps = PropsWithChildren<
React.HTMLAttributes<HTMLDivElement>
Expand All @@ -25,22 +18,11 @@ export const HeroInfo: React.FC<HeroInfoProps> = ({
}) => {
const ctx = useHero()
const size = sizeProp ? sizeProp : ctx ? ctx.size : 'medium'
const [mb, setMb] = React.useState(0)
const scrollY = useScrollY()

useEffect(() => {
if (isMobile()) {
setMb(calcHeroInfoMb(scrollY))
}
}, [scrollY])

return (
<>
<div
className={clsx(className, 'mdx-hero-info', `mdx-hero-info--${size}`)}
style={{
marginBottom: `calc(100vh - var(--logos-hero-info-height) - ${mb}px)`,
}}
{...(props as any)}
>
{children}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@
@use '../../../css/lsd';

.mdx-hero-title {
font-weight: 300 !important;
z-index: 1;
text-shadow: 0px 0px 6px rgba(var(--lsd-surface-primary), 0.5);
@include lsd.typography('h4');
font-size: 70px !important;
font-weight: 100 !important;
line-height: 100% !important;
}

.mdx-hero-title--large {
@include lsd.typography('h1');
//font-size: 5.0625rem !important;
//line-height: 5rem !important;
}

.mdx-hero-title--medium {
@include lsd.typography('h2');
}

.mdx-hero-title--uppercase {
Expand All @@ -24,17 +19,12 @@

@include utils.responsive('lg', 'down') {
.mdx-hero-title {
@include lsd.typography('h4');
text-transform: uppercase;
font-size: 28px !important;
}

.mdx-hero-title--medium {
@include lsd.typography('h4');
}

.mdx-hero-title--large {
//font-size: 1.875rem !important;
//line-height: 2.1rem !important;
font-size: 2.175rem !important;
line-height: 2.475rem !important;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
@use '../../../css/utils';

.mdx-hero-video {
display: grid;
grid-template-rows: 1fr;
grid-template-columns: 1fr;

pointer-events: none;

--hero-video-scale: 58%;
--hero-video-offset-y: -10%;
--hero-video-scale-mobile: 117.8%;
--hero-video-offset-y-mobile: -10%;

& > * {
grid-row: 1 / 1;
grid-column: 1 / 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;

transform: translateY(var(--hero-video-offset-y));

max-width: 100%;
height: 100%;
width: auto;
}

.mdx-hero-video__placeholder {
opacity: 0;
visibility: hidden;
}

img,
video {
width: 100%;
height: auto;
transform: scale(var(--hero-video-scale));
margin-left: calc((var(--hero-video-scale) - 100%) * -1);
transform-origin: top left;
}
}

.mdx-hero-video--loading {
.mdx-hero-video__video {
opacity: 0;
visibility: hidden;
}

.mdx-hero-video__placeholder {
opacity: 1;
visibility: visible;
}
}

@include utils.responsive('lg', 'down') {
.mdx-hero-video {
> * {
transform: translateY(var(--hero-video-offset-y-mobile));
}

img,
video {
width: 100%;
transform: scale(var(--hero-video-scale-mobile));
margin-left: calc((var(--hero-video-scale-mobile) - 100%) * -1);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import clsx from 'clsx'
import React, { PropsWithChildren, useEffect, useRef, useState } from 'react'
import { makeStyle } from '../../../lib/makeStyle'
import { settle } from '../../../lib/settle'
import { useHero } from '../Hero/Hero.context'
import './HeroVideo.scss'

export type HeroVideoStyle = {
scale?: string
offsetY?: string
}

export type HeroVideoProps = PropsWithChildren<
React.HTMLAttributes<HTMLDivElement>
> & {
placeholderSrc: string
desktop?: HeroVideoStyle
mobile?: HeroVideoStyle
}

export const HeroVideo: React.FC<HeroVideoProps> = ({
placeholderSrc,
desktop,
mobile,
className,
style = {},
children,
...props
}) => {
const ctx = useHero()
const ref = useRef<HTMLVideoElement>(null)
const [loading, setLoading] = useState(true)

const play = async () => {
const el = ref.current
if (!el) return

await settle(() => el.play())
}

const onCanPlay = async () => {
loading && setLoading(false)
await play()
}

const onEnded = async () => {
await play()
}

return (
<>
<div
className={clsx(
className,
'mdx-hero-video',
loading && 'mdx-hero-video--loading',
)}
style={makeStyle(
{ ...style },
{
'hero-video-scale': desktop?.scale ?? '58%',
'hero-video-offset-y': desktop?.offsetY ?? '-10%',
'hero-video-scale-mobile': mobile?.scale ?? '117.8%',
'hero-video-offset-y-desktop': mobile?.offsetY ?? '-10%',
},
)}
{...(props as any)}
>
<div className="mdx-hero-video__placeholder">
<img src={placeholderSrc} alt="" />
</div>
<div className="mdx-hero-video__video">
<video
muted
autoPlay
onEnded={onEnded}
onCanPlay={onCanPlay}
ref={ref}
>
{children}
</video>
</div>
</div>
</>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './HeroVideo'

0 comments on commit c6eb842

Please sign in to comment.