UNPKG

mobile-react-infinite-calendar

Version:

A mobile-optimized infinite scroll calendar component for React

21 lines (20 loc) 1.12 kB
import { jsx as _jsx } from "react/jsx-runtime"; import { memo, useMemo } from 'react'; import { cn } from '../utils/cn'; import { getWeekDays } from '../utils/localeUtils'; const WeekDaysHeader = memo(function WeekDaysHeader({ locale, classNames, show }) { // 요일 데이터 (메모이제이션) const weekDays = useMemo(() => getWeekDays(locale), [locale]); // 요일 클래스네임 (메모이제이션) const weekDayClassName = useMemo(() => { return (index) => cn("py-2 text-center text-sm font-bold border-b border-gray-200", index === 0 && "text-red-500", // 일요일 index === 6 && "text-blue-500", // 토요일 classNames === null || classNames === void 0 ? void 0 : classNames.weekDay); }, [classNames === null || classNames === void 0 ? void 0 : classNames.weekDay]); if (!show) { return null; } return (_jsx("div", { className: "grid grid-cols-7", children: weekDays.map((day, index) => (_jsx("div", { className: weekDayClassName(index), children: day }, day))) })); }); WeekDaysHeader.displayName = 'WeekDaysHeader'; export { WeekDaysHeader };