|
| 1 | +import { useGSAP } from "@gsap/react"; |
| 2 | +import { YouTubeEmbed } from "@next/third-parties/google"; |
| 3 | +import gsap from "gsap"; |
| 4 | +import { ChevronDown, ChevronRight } from "lucide-react"; |
| 5 | +import Link from "next/link"; |
| 6 | +import { useRef } from "react"; |
| 7 | + |
| 8 | +import { useFontLoadState } from "@/shared/hooks/useFontLoadState"; |
| 9 | + |
| 10 | +import styles from "./YoutubeHeroSection.module.scss"; |
| 11 | + |
| 12 | +export const YoutubeHeroSection = () => { |
| 13 | + const titleRef = useRef<HTMLHeadingElement>(null); |
| 14 | + const textRef = useRef<HTMLDivElement>(null); |
| 15 | + const registerButtonRef = useRef<HTMLButtonElement>(null); |
| 16 | + const { fontLoaded } = useFontLoadState(); |
| 17 | + |
| 18 | + useGSAP(() => { |
| 19 | + if (!fontLoaded) return; |
| 20 | + |
| 21 | + const timeline = gsap.timeline(); |
| 22 | + timeline.fromTo(titleRef.current, { opacity: 0, y: 50 }, { opacity: 1, y: 0, duration: 2, ease: "expo.out" }); |
| 23 | + }, [fontLoaded]); |
| 24 | + |
| 25 | + return ( |
| 26 | + <section className={styles.yt_hero_section__wrapper}> |
| 27 | + <h1 className={styles.yt_hero_section__title} ref={titleRef} style={{ opacity: fontLoaded ? 1 : 0 }}> |
| 28 | + <span>당신의 수능을 바꿀 </span> |
| 29 | + <span>마지막 기회</span> |
| 30 | + </h1> |
| 31 | + |
| 32 | + <article className={styles.yt_hero_section__video}> |
| 33 | + <YouTubeEmbed videoid={"sy0h73_DO5M"} style="margin: 0px auto;" /> |
| 34 | + </article> |
| 35 | + |
| 36 | + <div ref={textRef} className={styles.yt_hero_section__content} style={{ opacity: fontLoaded ? 1 : 0 }}> |
| 37 | + <p> |
| 38 | + <span>모의가 아닌 진짜 수능 이용 가이드입니다.</span> |
| 39 | + </p> |
| 40 | + |
| 41 | + <Link href="/apply" scroll> |
| 42 | + <button ref={registerButtonRef}> |
| 43 | + <span>지금 바로 신청하기</span> |
| 44 | + <span> |
| 45 | + <ChevronRight strokeWidth={1} /> |
| 46 | + </span> |
| 47 | + </button> |
| 48 | + </Link> |
| 49 | + |
| 50 | + <footer className={styles.yt_hero_section__footer}> |
| 51 | + <ChevronDown size={30} /> |
| 52 | + </footer> |
| 53 | + </div> |
| 54 | + </section> |
| 55 | + ); |
| 56 | +}; |
0 commit comments