import React from 'react'; import PropTypes from 'prop-types'; import Days from './MonthView/Days'; import Weekdays from './MonthView/Weekdays'; import WeekNumbers from './MonthView/WeekNumbers'; import { CALENDAR_TYPES, CALENDAR_TYPE_LOCALES } from './shared/const'; import { isCalendarType } from './shared/propTypes'; function getCalendarTypeFromLocale(locale) { return ( Object.keys(CALENDAR_TYPE_LOCALES) .find((calendarType) => CALENDAR_TYPE_LOCALES[calendarType].includes(locale)) || CALENDAR_TYPES.ISO_8601 ); } export default function MonthView(props) { const { activeStartDate, locale, onMouseLeave, showFixedNumberOfWeeks, } = props; const { calendarType = getCalendarTypeFromLocale(locale), formatShortWeekday, onClickWeekNumber, showWeekNumbers, ...childProps } = props; function renderWeekdays() { return ( ); } function renderWeekNumbers() { if (!showWeekNumbers) { return null; } return ( ); } function renderDays() { return ( ); } const className = 'react-calendar__month-view'; return (
{renderWeekNumbers()}
{renderWeekdays()} {renderDays()}
); } MonthView.propTypes = { activeStartDate: PropTypes.instanceOf(Date).isRequired, calendarType: isCalendarType, formatShortWeekday: PropTypes.func, locale: PropTypes.string, onClickWeekNumber: PropTypes.func, onMouseLeave: PropTypes.func, showFixedNumberOfWeeks: PropTypes.bool, showWeekNumbers: PropTypes.bool, };