mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-03 06:27:11 +01:00
style calendar a bit
This commit is contained in:
committed by
Thomas Ruoff
parent
451d0e2d78
commit
8925a9ed7f
@@ -1,5 +1,5 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import cx from 'classnames'
|
import classnames from 'classnames'
|
||||||
import useSWR from 'swr'
|
import useSWR from 'swr'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import { Calendar } from 'react-calendar-component'
|
import { Calendar } from 'react-calendar-component'
|
||||||
@@ -29,15 +29,17 @@ export default function MyCalendar() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<div className="mb-12">
|
||||||
<h2>Buchungsübersicht</h2>
|
<h2 className="text-xl">Buchungsübersicht</h2>
|
||||||
<Calendar
|
<Calendar
|
||||||
onChangeMonth={(date) => setDate(date)}
|
onChangeMonth={(date: React.SetStateAction<moment.Moment>) =>
|
||||||
|
setDate(date)
|
||||||
|
}
|
||||||
date={date}
|
date={date}
|
||||||
renderDay={({ day, classNames, onPickDate }) => (
|
renderDay={({ day, classNames, onPickDate }) => (
|
||||||
<div
|
<div
|
||||||
key={day.format()}
|
key={day.format()}
|
||||||
className={cx(
|
className={classnames(
|
||||||
'Calendar-grid-item',
|
'Calendar-grid-item',
|
||||||
day.isSame(moment(), 'day') && 'Calendar-grid-item--current',
|
day.isSame(moment(), 'day') && 'Calendar-grid-item--current',
|
||||||
dayBooked(day.toDate()) && 'Calendar-grid-item--booked',
|
dayBooked(day.toDate()) && 'Calendar-grid-item--booked',
|
||||||
@@ -59,6 +61,16 @@ export default function MyCalendar() {
|
|||||||
)}
|
)}
|
||||||
onPickDate={() => {}}
|
onPickDate={() => {}}
|
||||||
/>
|
/>
|
||||||
</>
|
<div className="mt-6 flex justify-center">
|
||||||
|
<div>
|
||||||
|
<div className="inline-block w-5 h-5 bg-green-200 rounded align-text-bottom"></div>
|
||||||
|
<span className="ml-2">Frei</span>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div className="ml-6 inline-block w-5 h-5 bg-red-200 rounded align-text-bottom"></div>
|
||||||
|
<span className="ml-2">Belegt</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -111,61 +111,41 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-grid {
|
.Calendar-grid {
|
||||||
display: flex;
|
@apply flex flex-wrap;
|
||||||
flex-wrap: wrap;
|
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-header {
|
.Calendar-header {
|
||||||
height: 50px;
|
@apply flex justify-between bg-gray-700 text-gray-200 text-center;
|
||||||
background: #333;
|
|
||||||
color: #fff;
|
|
||||||
text-align: center;
|
|
||||||
line-height: 50px;
|
|
||||||
display: flex;
|
|
||||||
font-size: 20px;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-header button {
|
.Calendar-header button {
|
||||||
width: 50px;
|
@apply w-10 bg-transparent text-gray-200 cursor-pointer;
|
||||||
font-size: 20px;
|
|
||||||
border: 0;
|
|
||||||
background: transparent;
|
|
||||||
color: #ddd;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-grid-item {
|
.Calendar-grid-item {
|
||||||
flex: 0 14.28571%;
|
@apply text-center p-1 bg-green-200 border-r border-b border-solid border-gray-500;
|
||||||
text-align: center;
|
flex: 0 calc(100% / 7);
|
||||||
border-right: 1px solid #ddd;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
padding: 1rem;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-grid-item--current {
|
.Calendar-grid-item--current {
|
||||||
font-weight: 700;
|
@apply font-bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-grid-item--booked {
|
.Calendar-grid-item--booked {
|
||||||
@apply bg-red-300;
|
@apply bg-red-200 cursor-not-allowed;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-grid-item.nextMonth,
|
.Calendar-grid-item.nextMonth,
|
||||||
.Calendar-grid-item.prevMonth {
|
.Calendar-grid-item.prevMonth {
|
||||||
color: #999;
|
@apply text-gray-500;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-grid-item:nth-child(7n + 1) {
|
.Calendar-grid-item:nth-child(7n + 1) {
|
||||||
border-left: 1px solid #ddd;
|
@apply border-l;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Calendar-grid-item:nth-child(-n + 7) {
|
.Calendar-grid-item:nth-child(-n + 7) {
|
||||||
border-top: 1px solid #ddd;
|
@apply border-t;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start purging... */
|
/* Start purging... */
|
||||||
|
|||||||
Reference in New Issue
Block a user