feat: add HomeVideosSection component with YouTube video integration

This commit is contained in:
poyrazavsever
2026-03-10 21:43:46 +03:00
parent 9142962fce
commit 17ec09f8ab
3 changed files with 59 additions and 0 deletions
+2
View File
@@ -1,4 +1,5 @@
import { HomeHero } from "@/components/home-hero"; import { HomeHero } from "@/components/home-hero";
import { HomeVideosSection } from "@/components/home-videos-section";
import { ReferencesSection } from "@/components/references-section"; import { ReferencesSection } from "@/components/references-section";
export default function Home() { export default function Home() {
@@ -6,6 +7,7 @@ export default function Home() {
<section className="flex h-full flex-col gap-4 overflow-hidden"> <section className="flex h-full flex-col gap-4 overflow-hidden">
<HomeHero /> <HomeHero />
<ReferencesSection /> <ReferencesSection />
<HomeVideosSection />
</section> </section>
); );
} }
+52
View File
@@ -0,0 +1,52 @@
import { Card, Typography } from "poyraz-ui/atoms";
import { YOUTUBE_VIDEO_LINKS } from "@/data/youtube-videos";
function getYoutubeEmbedUrl(link: string) {
try {
const url = new URL(link);
const videoId = url.searchParams.get("v");
return videoId ? `https://www.youtube.com/embed/${videoId}` : null;
} catch {
return null;
}
}
export function HomeVideosSection() {
return (
<section className="space-y-2">
<Typography variant="large" className="text-base">
YouTube
</Typography>
<div className="grid gap-2 md:grid-cols-3">
{YOUTUBE_VIDEO_LINKS.map((link) => {
const embedUrl = getYoutubeEmbedUrl(link);
return (
<Card key={link} className="overflow-hidden rounded-sm border-border p-0">
{embedUrl ? (
<div className="aspect-video w-full">
<iframe
src={embedUrl}
title="YouTube video player"
className="h-full w-full"
loading="lazy"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerPolicy="strict-origin-when-cross-origin"
allowFullScreen
/>
</div>
) : (
<div className="p-3">
<Typography variant="small" className="text-muted-foreground">
Invalid video link.
</Typography>
</div>
)}
</Card>
);
})}
</div>
</section>
);
}
+5
View File
@@ -0,0 +1,5 @@
export const YOUTUBE_VIDEO_LINKS = [
"https://www.youtube.com/watch?v=9JEOGCX5aSQ&t=22s",
"https://www.youtube.com/watch?v=H8sP8HejI7A",
"https://www.youtube.com/watch?v=XWUeVzf0t6Y&t=2s",
] as const;