|
1 | 1 | import { Button } from "@/components/ui/button"; |
2 | 2 | import { Card } from "@/components/ui/card"; |
| 3 | +import Image from "next/image"; |
3 | 4 | import Link from "next/link"; |
4 | 5 |
|
5 | | -export function FeaturedProgram() { |
| 6 | +type FeaturedProgramProps = { |
| 7 | + heading: string; |
| 8 | + description: string; |
| 9 | + mediaSrc: string; |
| 10 | + mediaAlt?: string; |
| 11 | + isVideo?: boolean; |
| 12 | + ctaHref: string; |
| 13 | + ctaLabel?: string; |
| 14 | +}; |
| 15 | + |
| 16 | +export function FeaturedProgram({ |
| 17 | + heading, |
| 18 | + description, |
| 19 | + mediaSrc, |
| 20 | + mediaAlt, |
| 21 | + isVideo = false, |
| 22 | + ctaHref, |
| 23 | + ctaLabel = "Learn More", |
| 24 | +}: FeaturedProgramProps) { |
6 | 25 | return ( |
7 | 26 | <section> |
8 | 27 | <div className="container mx-auto px-4"> |
9 | 28 | <Card className="p-8 border-primary/35 hover:border-primary transition-all"> |
10 | 29 | <div className="grid md:grid-cols-2 gap-8 items-center"> |
11 | 30 | <div className="space-y-4"> |
12 | | - <h2 className="text-3xl font-bold">Featured Program</h2> |
13 | | - <p className="text-muted-foreground"> |
14 | | - This is a description of the featured program. It highlights a key initiative and invites |
15 | | - users to learn more. |
16 | | - </p> |
17 | | - <Button asChild> |
18 | | - <Link href="#placeholder">Learn More</Link> |
19 | | - </Button> |
| 31 | + <h2 className="text-3xl font-bold">{heading}</h2> |
| 32 | + <p className="text-muted-foreground">{description}</p> |
| 33 | + {ctaHref && ctaLabel ? ( |
| 34 | + <Button asChild> |
| 35 | + <Link href={ctaHref}>{ctaLabel}</Link> |
| 36 | + </Button> |
| 37 | + ) : null} |
20 | 38 | </div> |
21 | 39 | <div> |
22 | | - <div className="aspect-video bg-muted rounded-lg flex items-center justify-center"> |
23 | | - <p className="text-muted-foreground">Embedded Video</p> |
| 40 | + <div className="relative aspect-video bg-muted rounded-lg overflow-hidden"> |
| 41 | + {isVideo ? ( |
| 42 | + <video |
| 43 | + src={mediaSrc} |
| 44 | + controls |
| 45 | + className="h-full w-full object-contain" |
| 46 | + /> |
| 47 | + ) : ( |
| 48 | + <Image |
| 49 | + src={mediaSrc} |
| 50 | + alt={mediaAlt ?? heading} |
| 51 | + fill |
| 52 | + className="object-contain" |
| 53 | + sizes="(min-width: 768px) 50vw, 100vw" |
| 54 | + unoptimized |
| 55 | + /> |
| 56 | + )} |
24 | 57 | </div> |
25 | 58 | </div> |
26 | 59 | </div> |
|
0 commit comments