You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.2 KiB
TypeScript

import React from 'react';
import { YearProps } from '../../../types/calendar';
import { Month } from '../Month';
import styles from './Year.module.scss';
export const Year: React.FC<YearProps> = ({
year,
dayHeaderStyle,
monthDayOfWeekHeaderStyle,
monthCutoff,
weekendDays,
dateRange,
onDateSelect,
onDateHover,
size = 'l',
fontProportion = 100,
magnify = false
}) => {
const months = Array.from({ length: 12 }, (_, index) => {
const monthDate = new Date(year, index, 1);
return (
<Month
key={index}
date={monthDate}
dayHeaderStyle={dayHeaderStyle}
monthDayOfWeekHeaderStyle={monthDayOfWeekHeaderStyle}
direction="column"
monthCutoff={monthCutoff}
weekendDays={weekendDays}
dateRange={dateRange}
onDateSelect={onDateSelect}
onDateHover={onDateHover}
size={size}
fontProportion={fontProportion}
magnify={magnify}
/>
);
});
return (
<div className={styles.Year__Wrapper}>
<h1 className={styles.Year__Title}>{year}</h1>
<div className={styles.Year__MonthsGrid}>
{months}
</div>
</div>
);
};