mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
render past days in gray
This commit is contained in:
committed by
Thomas Ruoff
parent
18337a7ac7
commit
eb82b9b292
@@ -1,7 +1,7 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import classnames from 'classnames'
|
import classnames from 'classnames'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import moment from 'moment'
|
import moment, { Moment } from 'moment'
|
||||||
import { Calendar } from 'react-calendar-component'
|
import { Calendar } from 'react-calendar-component'
|
||||||
import { dateFormatBackend } from '../helpers/date'
|
import { dateFormatBackend } from '../helpers/date'
|
||||||
|
|
||||||
@@ -32,16 +32,23 @@ export default function MyCalendar() {
|
|||||||
<div className="mb-12">
|
<div className="mb-12">
|
||||||
<h2 className="text-xl">Buchungsübersicht</h2>
|
<h2 className="text-xl">Buchungsübersicht</h2>
|
||||||
<Calendar
|
<Calendar
|
||||||
onChangeMonth={(date: React.SetStateAction<moment.Moment>) =>
|
onChangeMonth={(date: React.SetStateAction<Moment>) => setDate(date)}
|
||||||
setDate(date)
|
|
||||||
}
|
|
||||||
date={date}
|
date={date}
|
||||||
renderDay={({ day, classNames, onPickDate }) => (
|
renderDay={({
|
||||||
|
day,
|
||||||
|
classNames,
|
||||||
|
onPickDate,
|
||||||
|
}: {
|
||||||
|
day: Moment
|
||||||
|
classNames: string
|
||||||
|
onPickDate: any
|
||||||
|
}) => (
|
||||||
<div
|
<div
|
||||||
key={day.format()}
|
key={day.format()}
|
||||||
className={classnames(
|
className={classnames(
|
||||||
'Calendar-grid-item',
|
'Calendar-grid-item',
|
||||||
day.isSame(moment(), 'day') && 'Calendar-grid-item--current',
|
day.isSame(moment(), 'day') && 'Calendar-grid-item--current',
|
||||||
|
day.isBefore(moment(), 'day') && 'Calendar-grid-item--past',
|
||||||
dayBooked(day.toDate()) && 'Calendar-grid-item--booked',
|
dayBooked(day.toDate()) && 'Calendar-grid-item--booked',
|
||||||
classNames
|
classNames
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -127,6 +127,10 @@
|
|||||||
flex: 0 calc(100% / 7);
|
flex: 0 calc(100% / 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Calendar-grid-item--past {
|
||||||
|
@apply text-gray-500 bg-gray-200;
|
||||||
|
}
|
||||||
|
|
||||||
.Calendar-grid-item--current {
|
.Calendar-grid-item--current {
|
||||||
@apply font-bold;
|
@apply font-bold;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user