Skip to content

Commit

Permalink
Add …--weekend class to Weekdays tiles (#490)
Browse files Browse the repository at this point in the history
Co-authored-by: Wojciech Maj <[email protected]>
  • Loading branch information
fffed and wojtekmaj committed Feb 4, 2022
1 parent 8f8d0b1 commit b0dc446
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/MonthView/Weekdays.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React from 'react';
import PropTypes from 'prop-types';
import mergeClassNames from 'merge-class-names';
import { getYear, getMonth, getMonthStart } from '@wojtekmaj/date-utils';

import Flex from '../Flex';

import { getDayOfWeek } from '../shared/dates';
import { getDayOfWeek, isWeekend } from '../shared/dates';
import {
formatWeekday,
formatShortWeekday as defaultFormatShortWeekday,
} from '../shared/dateFormatter';
import { isCalendarType } from '../shared/propTypes';

const className = 'react-calendar__month-view__weekdays';
const weekdayClassName = `${className}__weekday`;

export default function Weekdays(props) {
const {
Expand All @@ -38,7 +40,13 @@ export default function Weekdays(props) {
const abbr = formatWeekday(locale, weekdayDate);

weekdays.push(
<div key={weekday} className={`${className}__weekday`}>
<div
key={weekday}
className={mergeClassNames(
weekdayClassName,
isWeekend(weekdayDate, calendarType) && `${weekdayClassName}--weekend`,
)}
>
<abbr aria-label={abbr} title={abbr}>
{formatShortWeekday(locale, weekdayDate).replace('.', '')}
</abbr>
Expand Down

0 comments on commit b0dc446

Please sign in to comment.