Skip to content

Commit 2f6a201

Browse files
authored
Fix: Landing page hero section responsiveness issue (#1107)
* fix: hero section responsiveness issue * fix: stars position * fix height on desktop * remove unused code
1 parent ae3ac97 commit 2f6a201

File tree

2 files changed

+33
-52
lines changed

2 files changed

+33
-52
lines changed

src/app/page.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,12 +179,7 @@ export default function LandingPage() {
179179

180180
return (
181181
<Layout className="enable-select !m-0 w-full !p-0">
182-
<Hero
183-
heading={hero.heading}
184-
primaryCta={hero.primaryCta}
185-
buttonVisible={buttonVisible}
186-
buttonScale={buttonScale}
187-
/>
182+
<Hero primaryCta={hero.primaryCta} buttonVisible={buttonVisible} buttonScale={buttonScale} />
188183
<Marquee {...marqueeProps} />
189184
<NoFees />
190185
<Marquee {...marqueeProps} />

src/components/LandingPage/hero.tsx

Lines changed: 32 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ type CTAButton = {
1414
}
1515

1616
type HeroProps = {
17-
heading: string
1817
primaryCta?: CTAButton
1918
secondaryCta?: CTAButton
2019
buttonVisible?: boolean
@@ -47,7 +46,7 @@ const getHoverAnimation = (variant: 'primary' | 'secondary') => ({
4746
const transitionConfig = { type: 'spring', damping: 15 } as const
4847

4948
const getButtonContainerClasses = (variant: 'primary' | 'secondary') =>
50-
`relative z-20 mt-8 md:mt-12 ${variant === 'primary' ? 'mx-auto w-fit' : 'right-[calc(50%-120px)]'}`
49+
`relative z-20 mt-8 md:mt-12 flex flex-col items-center justify-center ${variant === 'primary' ? 'mx-auto w-fit' : 'right-[calc(50%-120px)]'}`
5150

5251
const getButtonClasses = (variant: 'primary' | 'secondary') =>
5352
`${variant === 'primary' ? 'btn bg-white fill-n-1 text-n-1 hover:bg-white/90' : 'btn-yellow'} px-7 md:px-9 py-3 md:py-8 text-base md:text-xl btn-shadow-primary-4`
@@ -99,26 +98,19 @@ const renderArrows = (variant: 'primary' | 'secondary', arrowOpacity: number, bu
9998
</>
10099
)
101100

102-
export function Hero({ heading, primaryCta, secondaryCta, buttonVisible, buttonScale = 1 }: HeroProps) {
101+
export function Hero({ primaryCta, secondaryCta, buttonVisible, buttonScale = 1 }: HeroProps) {
103102
const [screenWidth, setScreenWidth] = useState(typeof window !== 'undefined' ? window.innerWidth : 1200)
104-
const [scrollY, setScrollY] = useState(0)
105103

106104
useEffect(() => {
107105
const handleResize = () => {
108106
setScreenWidth(window.innerWidth)
109107
}
110108

111-
const handleScroll = () => {
112-
setScrollY(window.scrollY)
113-
}
114-
115109
handleResize()
116110
window.addEventListener('resize', handleResize)
117-
window.addEventListener('scroll', handleScroll)
118111

119112
return () => {
120113
window.removeEventListener('resize', handleResize)
121-
window.removeEventListener('scroll', handleScroll)
122114
}
123115
}, [])
124116

@@ -148,53 +140,47 @@ export function Hero({ heading, primaryCta, secondaryCta, buttonVisible, buttonS
148140
</Button>
149141
</a>
150142

151-
<p className="font-roboto-flex-bold mt-2 text-xs italic text-n-1 md:text-sm">Takes 10 seconds</p>
143+
<p className="font-roboto-flex-bold mx-auto mt-2 text-xs italic text-n-1 md:text-sm">
144+
Takes 10 seconds
145+
</p>
152146

153147
{renderArrows(variant, arrowOpacity, buttonVisible)}
154148
</motion.div>
155149
)
156150
}
157151

158152
return (
159-
<div className="relative flex h-[90vh] flex-col justify-between overflow-x-hidden overflow-y-hidden bg-primary-1">
153+
<section className="relative flex min-h-[85vh] w-full flex-col items-center justify-between bg-primary-1 px-4 py-4 xl:h-fit xl:justify-center">
160154
<CloudImages screenWidth={screenWidth} />
161-
162-
<div className="relative mb-8 mt-0 flex grow flex-col justify-between space-y-6 md:mb-10 md:mt-4">
155+
<div className="relative mt-10 w-full md:mt-0">
163156
<img
164-
src={PeanutGuyGIF.src}
165-
className="mg:bottom-0 absolute bottom-[55%] left-1/2 z-10 mx-auto h-auto max-h-[40vh] w-auto max-w-[90%] -translate-x-1/2 translate-y-1/2 transform object-contain"
166-
alt="Peanut Guy"
157+
src={ButterySmoothGlobalMoney.src}
158+
className="z-0 mx-auto w-full max-w-[1000px] object-contain md:w-[50%]"
159+
alt="Buttery Smooth Global Money"
167160
/>
168161

169-
<Stack spacing={2} className="relative h-1/3 items-center justify-center px-4 text-center lg:h-full">
170-
<img
171-
src={ButterySmoothGlobalMoney.src}
172-
className="z-0 mx-auto w-full max-w-[1000px] object-contain md:w-[50%]"
173-
alt="Buttery Smooth Global Money"
174-
/>
175-
176-
<HeroImages />
177-
</Stack>
178-
179-
<Stack spacing={2} className="relative h-1/3 items-center justify-center px-4 text-center lg:h-full">
180-
<div className="mt-8 md:mt-12 lg:mt-6">
181-
<h2 className="font-roboto-flex-extrabold text-[2.375rem] font-extraBlack text-black md:text-heading">
182-
INSTANTLY SEND & RECEIVE
183-
</h2>
184-
<span
185-
className="mt-2 block text-xl leading-tight text-n-1 md:mt-4 md:text-5xl"
186-
style={{ fontWeight: 500, letterSpacing: '-0.5px' }}
187-
>
188-
MONEY ACROSS THE GLOBE
189-
</span>
190-
</div>
191-
192-
{primaryCta && renderCTAButton(primaryCta, 'primary')}
193-
{secondaryCta && renderCTAButton(secondaryCta, 'secondary')}
194-
195-
<HeroImages />
196-
</Stack>
162+
<HeroImages />
163+
</div>
164+
<img
165+
src={PeanutGuyGIF.src}
166+
className="mg:bottom-0 absolute bottom-[55%] left-1/2 z-10 mx-auto h-auto max-h-[40vh] w-auto max-w-[90%] -translate-x-1/2 translate-y-1/2 transform object-contain"
167+
alt="Peanut Guy"
168+
/>
169+
170+
<div className="relative mb-4 flex w-full flex-col items-center justify-center md:mb-0">
171+
<h2 className="font-roboto-flex-extrabold mt-18 text-center text-[2.375rem] font-extraBlack text-black md:text-heading">
172+
INSTANTLY SEND & RECEIVE
173+
</h2>
174+
<span
175+
className="mt-2 block text-xl leading-tight text-n-1 md:mt-4 md:text-5xl"
176+
style={{ fontWeight: 500, letterSpacing: '-0.5px' }}
177+
>
178+
MONEY ACROSS THE GLOBE
179+
</span>
180+
{primaryCta && renderCTAButton(primaryCta, 'primary')}
181+
{secondaryCta && renderCTAButton(secondaryCta, 'secondary')}
182+
<HeroImages />
197183
</div>
198-
</div>
184+
</section>
199185
)
200186
}

0 commit comments

Comments
 (0)