Cleanup calendar styles
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import moment from "moment";
|
import moment from 'moment'
|
||||||
import { Accessor, Component, Setter } from "solid-js";
|
import { Accessor, Component, Setter } from 'solid-js'
|
||||||
|
|
||||||
import "../../css/calendar.css";
|
import styles from './calendar.module.css'
|
||||||
|
|
||||||
export const Calendar: Component<{
|
export const Calendar: Component<{
|
||||||
getSelectedDate: Accessor<Date>,
|
getSelectedDate: Accessor<Date>,
|
||||||
@@ -20,19 +20,19 @@ export const Calendar: Component<{
|
|||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h3>Calendar</h3>
|
<h3>Calendar</h3>
|
||||||
<div class="calendar-top">
|
<div class={styles.calendarTop}>
|
||||||
<button onClick={() => changeMonths(-1) }><<</button>
|
<button onClick={() => changeMonths(-1) }><<</button>
|
||||||
<div class="calendar-year-month">
|
<div class={styles.calendarYearMonth}>
|
||||||
{moment(getSelectedDate()).format("YYYY, MMM")}
|
{moment(getSelectedDate()).format("YYYY, MMM")}
|
||||||
</div>
|
</div>
|
||||||
<button onclick={() => changeMonths(1)}>>></button>
|
<button onclick={() => changeMonths(1)}>>></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="calendar">
|
<div class={styles.calendar}>
|
||||||
{ getPaddedMonth(getSelectedDate()).map(d => {
|
{ getPaddedMonth(getSelectedDate()).map(d => {
|
||||||
const classArr = ["calendar-cell"];
|
const classArr = [styles.calendarCell];
|
||||||
if (d.getMonth() !== getSelectedDate().getMonth()) classArr.push("prev-month");
|
if (d.getMonth() !== getSelectedDate().getMonth()) classArr.push(styles.prevMonth)
|
||||||
if (dateStrArr().includes(d.toDateString())) classArr.push("data-date");
|
if (dateStrArr().includes(d.toDateString())) classArr.push(styles.dataDate)
|
||||||
if (d.toDateString() === getSelectedDate().toDateString()) classArr.push("current-date");
|
if (d.toDateString() === getSelectedDate().toDateString()) classArr.push(styles.currentDate)
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={classArr.join(" ")}
|
class={classArr.join(" ")}
|
||||||
|
|||||||
@@ -4,19 +4,19 @@
|
|||||||
gap: 5px;
|
gap: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-top {
|
.calendarTop {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-nav {
|
.calendarNav {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-nav button {
|
.calendarNav button {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
border: none;
|
border: none;
|
||||||
@@ -24,11 +24,11 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-year-month {
|
.calendarYearMonth {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-cell {
|
.calendarCell {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -36,20 +36,20 @@
|
|||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.prev-month,
|
.prevMonth,
|
||||||
.next-month {
|
.nextMonth {
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.data-date {
|
.dataDate {
|
||||||
background-color: #99ccff;
|
background-color: #99ccff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.current-date {
|
.currentDate {
|
||||||
background-color: #ffcc66;
|
background-color: #ffcc66;
|
||||||
}
|
}
|
||||||
|
|
||||||
.calendar-cell:hover {
|
.calendarCell:hover {
|
||||||
background-color: #f2f2f2;
|
background-color: #f2f2f2;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user