'use client'; import { ChevronLeft, ChevronRight } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { cn } from '@/components/ui/utils'; import type { CalendarHeaderProps, CalendarView } from './types'; import { formatYearMonth } from './utils'; /** * 달력 헤더 컴포넌트 * - 년월 표시 및 네비게이션 (◀ ▶) * - 주/월 뷰 전환 탭 * - 필터 slot (children으로 외부 주입) */ export function CalendarHeader({ currentDate, view, onPrevMonth, onNextMonth, onViewChange, titleSlot, filterSlot, }: CalendarHeaderProps) { const views: { value: CalendarView; label: string }[] = [ { value: 'week', label: '주' }, { value: 'month', label: '월' }, ]; return (
{/* 좌측: 타이틀 + 년월 네비게이션 */}
{titleSlot && ( {titleSlot} )}
{formatYearMonth(currentDate)}
{/* 우측: 뷰 전환 + 필터 */}
{/* 뷰 전환 탭 */}
{views.map((v) => ( ))}
{/* 필터 슬롯 */} {filterSlot &&
{filterSlot}
}
); }