|
1 | | -import HomeAlbumSection from "./section/album"; |
2 | | -import NavSection from "./section/nav"; |
| 1 | +import Image from "next/image"; |
3 | 2 | import VideosSection from "./section/videos"; |
| 3 | +import Link from "next/link"; |
| 4 | +import { Button } from "../ui/button"; |
| 5 | +import { useGetLive } from "@/query/youtube"; |
| 6 | +import { Suspense } from "@suspensive/react"; |
| 7 | +import { YoutubeVideo } from "ui"; |
| 8 | + |
| 9 | +const getYoutubeId = (url?: string) => { |
| 10 | + if (!url) return null; |
| 11 | + const trimmed = url.trim(); |
| 12 | + if (trimmed.length === 11) return trimmed; |
| 13 | + |
| 14 | + const videoRegExp = /^.*(youtu.be\/|v\/|u\/\w\/|shorts\/|live\/|watch\?v=|&v=)([^#&?]*).*/; |
| 15 | + const playlistRegExp = /[?&]list=([^#&?]+)/; |
| 16 | + |
| 17 | + const videoMatch = trimmed.match(videoRegExp); |
| 18 | + const playlistMatch = trimmed.match(playlistRegExp); |
| 19 | + |
| 20 | + const videoId = videoMatch && videoMatch[2]?.length === 11 ? videoMatch[2] : null; |
| 21 | + const playlistId = playlistMatch ? playlistMatch[1] : null; |
| 22 | + |
| 23 | + return videoId || playlistId || null; |
| 24 | +}; |
| 25 | + |
| 26 | +const TopHeroYoutube = () => { |
| 27 | + // const { data } = useGetYoutubeLinkSuspense("main"); |
| 28 | + // const firstVideoUrl = data?.videos?.[0]?.url; |
| 29 | + const firstVideoUrl = "https://youtu.be/9K0FrEAYQro"; |
| 30 | + const videoId = getYoutubeId(firstVideoUrl); |
| 31 | + |
| 32 | + if (!videoId) return null; |
| 33 | + |
| 34 | + return ( |
| 35 | + <div className="absolute inset-0 overflow-hidden opacity-70"> |
| 36 | + <YoutubeVideo |
| 37 | + videoId={videoId} |
| 38 | + className="h-full w-full origin-center scale-[1.05] transform-gpu sm:scale-[1.2]" |
| 39 | + autoplay |
| 40 | + mute |
| 41 | + loop |
| 42 | + /> |
| 43 | + </div> |
| 44 | + ); |
| 45 | +}; |
| 46 | + |
| 47 | +const HomePage2 = () => { |
| 48 | + const { data } = useGetLive(); |
4 | 49 |
|
5 | | -const HomePage = () => { |
6 | 50 | return ( |
7 | | - <div className="flex flex-col pb-12 md:pb-20 lg:pb-40"> |
8 | | - <NavSection /> |
9 | | - <VideosSection /> |
10 | | - {/* <div className="h-[8px] w-full bg-[#E6E6E6]" /> |
11 | | - <HomeAlbumSection /> */} |
| 51 | + <div className="flex min-h-screen flex-col bg-white"> |
| 52 | + <main className="flex-1"> |
| 53 | + {/* Video Hero Section - Compact */} |
| 54 | + <section className="relative z-0 aspect-[2.2] w-full overflow-hidden sm:aspect-[2.95]"> |
| 55 | + <div className="absolute inset-0 bg-[#1e2a4a]" /> |
| 56 | + <Suspense clientOnly fallback={<div className="absolute inset-0" />}> |
| 57 | + <TopHeroYoutube /> |
| 58 | + </Suspense> |
| 59 | + </section> |
| 60 | + |
| 61 | + {/* Welcome Section */} |
| 62 | + <section className="px-6 pb-24 pt-12 sm:pb-28 sm:pt-16 lg:px-16 lg:pb-36 lg:pt-20"> |
| 63 | + <div className="mx-auto flex max-w-7xl flex-col gap-4"> |
| 64 | + <div className="flex flex-col gap-16"> |
| 65 | + <div className="flex flex-col gap-4"> |
| 66 | + <h1 className="font-poppins flex flex-col text-3xl font-bold leading-tight text-[#1e2a4a] sm:text-5xl lg:text-6xl"> |
| 67 | + <span className="text-[#333333]">LOVE BEGINS,</span> |
| 68 | + <span className="">MYUNGMOON CHURCH!</span> |
| 69 | + </h1> |
| 70 | + <p className="text-base font-bold text-[#1e2a4a] sm:text-[22px]"> |
| 71 | + 사랑의 시작, 명문교회에 오신 것을 환영합니다! |
| 72 | + </p> |
| 73 | + </div> |
| 74 | + <div className="flex flex-col gap-4 sm:flex-row"> |
| 75 | + <Button className="rounded-none bg-[#1e2a4a] px-6 py-4 text-sm tracking-wider text-white hover:bg-[#2d3a5a] sm:px-8 sm:py-6"> |
| 76 | + <Link href={data?.url || ""} target="_blank"> |
| 77 | + 유튜브 라이브 |
| 78 | + </Link> |
| 79 | + </Button> |
| 80 | + <Button className="rounded-none bg-[#1e2a4a] px-6 py-4 text-sm tracking-wider text-white hover:bg-[#2d3a5a] sm:px-8 sm:py-6"> |
| 81 | + <Link href="/discipleship/homeworship">가정 예배</Link> |
| 82 | + </Button> |
| 83 | + </div> |
| 84 | + </div> |
| 85 | + </div> |
| 86 | + </section> |
| 87 | + |
| 88 | + {/* Plan Your Visit Section */} |
| 89 | + <section className="px-6 pb-24 lg:px-16"> |
| 90 | + <div className="mx-auto max-w-7xl"> |
| 91 | + <div className="flex flex-col gap-10 sm:gap-12 md:flex-row md:items-center md:gap-12 lg:gap-24"> |
| 92 | + <div className="relative aspect-video w-full max-w-3xl"> |
| 93 | + <Image |
| 94 | + src="/images/main_four_people.jpeg" |
| 95 | + alt="명문교회 찬양" |
| 96 | + fill |
| 97 | + className="object-cover" |
| 98 | + /> |
| 99 | + </div> |
| 100 | + <div className="md:max-w-md"> |
| 101 | + <h2 className="text-nowrap text-3xl font-bold text-[#1e2a4a] sm:text-4xl"> |
| 102 | + 처음오셨나요? |
| 103 | + </h2> |
| 104 | + <div className="my-6 h-[2px] w-16 bg-[#1e2a4a]" /> |
| 105 | + <p className="text-lg leading-relaxed text-[#496674]"> |
| 106 | + 여러분의 방문을 진심으로 환영합니다! |
| 107 | + <br /> |
| 108 | + 예배 안내와 오시는 방법 등 처음 방문 시 |
| 109 | + <br /> |
| 110 | + 필요한 모든 정보를 확인해 보세요. |
| 111 | + </p> |
| 112 | + <div className="mt-8"> |
| 113 | + <Button |
| 114 | + className="rounded-none bg-[#1e2a4a] px-8 py-6 text-sm tracking-wider text-white hover:bg-[#2d3a5a]" |
| 115 | + asChild |
| 116 | + > |
| 117 | + <Link href="/about/leadership">더 알아보기</Link> |
| 118 | + </Button> |
| 119 | + </div> |
| 120 | + </div> |
| 121 | + </div> |
| 122 | + </div> |
| 123 | + </section> |
| 124 | + |
| 125 | + <VideosSection /> |
| 126 | + |
| 127 | + {/* Next Generation Section */} |
| 128 | + <section className="bg-[#1e2a4a] px-6 py-16 text-white sm:py-20 lg:px-16 lg:py-24"> |
| 129 | + <div className="mx-auto max-w-4xl text-center"> |
| 130 | + <h2 className="text-3xl font-bold sm:text-4xl">Next Generation</h2> |
| 131 | + <div className="mx-auto my-6 h-[2px] w-16 bg-white" /> |
| 132 | + <p |
| 133 | + className="mx-auto max-w-2xl text-lg leading-relaxed text-white/80" |
| 134 | + suppressHydrationWarning |
| 135 | + > |
| 136 | + {"영아부부터 청년부까지, 다음 세대를 위한"} |
| 137 | + <br /> |
| 138 | + {"다양한 프로그램과 예배가 준비되어 있습니다."} |
| 139 | + </p> |
| 140 | + <div className="mt-10"> |
| 141 | + <Button |
| 142 | + className="rounded-none bg-white px-8 py-6 text-sm tracking-wider text-[#1e2a4a] hover:bg-white/90" |
| 143 | + asChild |
| 144 | + > |
| 145 | + <Link href="/education">더 알아보기</Link> |
| 146 | + </Button> |
| 147 | + </div> |
| 148 | + </div> |
| 149 | + </section> |
| 150 | + </main> |
12 | 151 | </div> |
13 | 152 | ); |
14 | 153 | }; |
15 | 154 |
|
16 | | -export default HomePage; |
| 155 | +export default HomePage2; |
0 commit comments