-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from Funssion-SWM/develop
랜딩페이지 수정
- Loading branch information
Showing
8 changed files
with
269 additions
and
234 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
'use client'; | ||
|
||
import Image, { StaticImageData } from 'next/image'; | ||
import { useEffect, useRef } from 'react'; | ||
import { gsap } from 'gsap'; | ||
import { ScrollTrigger } from 'gsap/ScrollTrigger'; | ||
type Props = { | ||
title1: string; | ||
title2: string; | ||
description1: string; | ||
description2: string; | ||
subImg: string | StaticImageData; | ||
mainImg: string | StaticImageData; | ||
subImgAlt: string; | ||
mainImgAlt: string; | ||
reverse?: boolean; | ||
}; | ||
|
||
gsap.registerPlugin(ScrollTrigger); | ||
|
||
export default function DescriptionBox({ | ||
title1, | ||
title2, | ||
description1, | ||
description2, | ||
subImg, | ||
mainImg, | ||
subImgAlt, | ||
mainImgAlt, | ||
reverse = false, | ||
}: Props) { | ||
const ref = useRef<null | HTMLDivElement>(null); | ||
|
||
useEffect(() => { | ||
if (ref.current) { | ||
const element = ref.current; | ||
gsap.fromTo( | ||
element, | ||
{ opacity: 0, y: 400 }, | ||
{ | ||
scrollTrigger: { | ||
trigger: element, | ||
start: 'top bottom', | ||
}, | ||
y: 0, | ||
opacity: 1, | ||
duration: 1, | ||
} | ||
); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<div | ||
className={`flex items-center justify-around h-full w-full font-semibold flex-col-reverse gap-8 md:gap-0 ${ | ||
reverse ? 'md:flex-row-reverse' : 'md:flex-row' | ||
}`} | ||
ref={ref} | ||
> | ||
<Image | ||
src={mainImg} | ||
alt={mainImgAlt} | ||
className="object-cover rounded-2xl sm:w-[550px] w-[350px] shadow-lg" | ||
/> | ||
<div className="px-4 sm:w-auto"> | ||
<Image src={subImg} alt={subImgAlt} className="w-[30px] sm:w-9 mt-5" /> | ||
<p className="mb-5 text-2xl font-bold leading-tight sm:text-4xl"> | ||
{title1} | ||
<br /> | ||
{title2} | ||
</p> | ||
<p className="text-sm font-normal sm:text-xl"> | ||
{description1} | ||
<br /> | ||
{description2} | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.