'use client' import React, { useEffect, useState } from 'react' interface CourseCardProps { tag: string tagColor?: 'blue' | 'green' | 'purple' | 'orange' title: string description: string href: string level?: string duration?: string isFree?: boolean } const tagColors = { blue: { bg: '#dbeafe', darkBg: '#1e3a5f', text: '#1e40af', darkText: '#93c5fd', border: '#93c5fd', darkBorder: '#3b82f6' }, green: { bg: '#ecfccb', darkBg: '#1a2e05', text: '#365314', darkText: '#bef264', border: '#bef264', darkBorder: '#84cc16' }, purple: { bg: '#f3e8ff', darkBg: '#2e1065', text: '#6b21a8', darkText: '#d8b4fe', border: '#d8b4fe', darkBorder: '#a855f7' }, orange: { bg: '#ffedd5', darkBg: '#431407', text: '#9a3412', darkText: '#fdba74', border: '#fdba74', darkBorder: '#f97316' } } const useDarkMode = () => { const [isDark, setIsDark] = useState(false) useEffect(() => { const checkDarkMode = () => { setIsDark(document.documentElement.classList.contains('dark')) } checkDarkMode() const observer = new MutationObserver(checkDarkMode) observer.observe(document.documentElement, { attributes: true, attributeFilter: ['class'] }) return () => observer.disconnect() }, []) return isDark } export const CourseCard = ({ tag, tagColor = 'blue', title, description, href, level, duration, isFree }: CourseCardProps) => { const isDark = useDarkMode() const colors = tagColors[tagColor] return ( { e.currentTarget.style.boxShadow = isDark ? '0 4px 12px rgba(0,0,0,0.4)' : '0 4px 12px rgba(0,0,0,0.1)' e.currentTarget.style.transform = 'translateY(-2px)' }} onMouseOut={(e) => { e.currentTarget.style.boxShadow = isDark ? '0 1px 3px rgba(0,0,0,0.3)' : '0 1px 3px rgba(0,0,0,0.05)' e.currentTarget.style.transform = 'translateY(0)' }} > {/* Colored tag bar */}
{tag}
{/* Card content */}

{title}

{description}

{/* Metadata footer */} {(level || duration) && (
{level}
{duration && ( {duration} )}
)}
) } interface CoursesSectionProps { title?: string children: React.ReactNode } export const CoursesSection = ({ title = "Related Learning", children }: CoursesSectionProps) => { const isDark = useDarkMode() return (

{title}

{children}
) } // Single card variant for inline use export const CoursePromo = ({ title = "Want to learn more?", description = "Learn more about advanced prompt engineering techniques and best practices in our AI courses.", href = "https://academy.dair.ai/", buttonText = "Explore Courses", promoCode }: { title?: string description?: string href?: string buttonText?: string promoCode?: string }) => { const isDark = useDarkMode() return (

{title}

{description} {promoCode && ( Use code {promoCode} for 20% off! )}

{ e.currentTarget.style.backgroundColor = '#1d4ed8' }} onMouseOut={(e) => { e.currentTarget.style.backgroundColor = '#2563eb' }} > {buttonText}
) }