'use client' import React, { useState } from 'react' import { CaretLeft, CaretRight } from '@phosphor-icons/react' import { motion } from 'framer-motion' export function CalendarWidget() { const [currentDate, setCurrentDate] = useState(new Date()) const today = new Date() const monthNames = [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ] const daysOfWeek = ['S', 'M', 'T', 'W', 'T', 'F', 'S'] const getDaysInMonth = (date: Date) => { const year = date.getFullYear() const month = date.getMonth() const firstDay = new Date(year, month, 1) const lastDay = new Date(year, month + 1, 0) const daysInMonth = lastDay.getDate() const startingDayOfWeek = firstDay.getDay() const days: (number | null)[] = [] for (let i = 0; i < startingDayOfWeek; i++) { days.push(null) } for (let i = 1; i <= daysInMonth; i++) { days.push(i) } return days } const days = getDaysInMonth(currentDate) const isToday = (day: number | null) => { if (!day) return false return ( day === today.getDate() && currentDate.getMonth() === today.getMonth() && currentDate.getFullYear() === today.getFullYear() ) } const previousMonth = () => { setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() - 1)) } const nextMonth = () => { setCurrentDate(new Date(currentDate.getFullYear(), currentDate.getMonth() + 1)) } return (
{/* Header */}
{monthNames[currentDate.getMonth()]} {currentDate.getFullYear()}
{/* Days of Week */}
{daysOfWeek.map((day, i) => (
{day}
))}
{/* Calendar Grid */}
{days.map((day, index) => (
{day}
))}
{/* Event Dots (Mock) */}
UPCOMING EVENTS
Team Meeting
10:00 AM - 11:00 AM
Project Review
2:00 PM - 3:30 PM
) }