FullCalendar
import dayGridPlugin from "@fullcalendar/daygrid";
import interactionPlugin from "@fullcalendar/interaction";
import FullCalendar from "@fullcalendar/react";
import timeGridPlugin from "@fullcalendar/timegrid";
import "./Calendar.css";
const Calendar = () => {
const plugin = [
dayGridPlugin,
timeGridPlugin,
interactionPlugin
];
return (
<FullCalendar
plugins={plugin}
initialView="dayGridMonth"
headerToolbar={{
left: "title",
right: "dayGridMonth,timeGridWeek,timeGridDay today"
}}
footerToolbar={{
left: "prev",
center: "",
right: "next"
}}
buttonText={{
today: "오늘",
month: "월별",
week: "주별",
day: "일별",
list: "리스트"
}}
events={scheduleData}
eventClick={eventClick}
eventChange={eventChange}
editable={true}
selectable={true}
selectMirror={true}
select={select}
weekends={true}
dayMaxEvents={true}
navLinks={true}
navLinkHint={"클릭시 해당 날짜로 이동합니다."}
eventsSet={function () {
console.log("eventsSet");
}}
eventAdd={function () {
console.log("eventAdd");
}}
eventDrop={function () {
console.log("eventDrop");
}}
eventRemove={function () {
console.log("eventRemove");
}}
/>
);
};
export default Calendar;
const scheduleData = [
{
title: "단일 date",
start: "2023-08-07T10:00:00",
end: "2023-08-07T14:00:00"
},
{
title: "단일 date",
start: "2023-08-05",
backgroundColor: "#727272",
textColor: "#ffffff",
borderColor: "#000000"
},
{ title: "단일 date", start: "2023-08-07", end: "2023-08-06" },
{ title: "복수 date", start: "2023-08-09", end: "2023-08-12" }
];
:root {
--fc-small-font-size: 0.85em;
--fc-page-bg-color: #fff;
--fc-neutral-bg-color: hsla(0, 0%, 82%, 0.3);
--fc-neutral-text-color: grey;
--fc-border-color: #ddd;
--fc-button-text-color: #fff;
--fc-button-bg-color: #f3af00;
--fc-button-border-color: #f3af00;
--fc-button-hover-bg-color: #f8cf66;
--fc-button-hover-border-color: #f8cf66;
--fc-button-active-bg-color: #f8cf66;
--fc-button-active-border-color: #f8cf66;
--fc-event-bg-color: #3788d8;
--fc-event-border-color: #3788d8;
--fc-event-text-color: #fff;
--fc-event-selected-overlay-color: rgba(0, 0, 0, 0.25);
--fc-more-link-bg-color: #d0d0d0;
--fc-more-link-text-color: inherit;
--fc-event-resizer-thickness: 8px;
--fc-event-resizer-dot-total-width: 8px;
--fc-event-resizer-dot-border-width: 1px;
--fc-non-business-color: hsla(0, 0%, 84%, 0.3);
--fc-bg-event-color: #8fdf82;
--fc-bg-event-opacity: 0.3;
--fc-highlight-color: rgba(188, 232, 241, 0.3);
--fc-today-bg-color: rgba(255, 220, 40, 0.15);
--fc-now-indicator-color: red;
--fc-daygrid-event-dot-width: 8px;
}
.fc {
height: 90vh;
margin: 20px;
}
.fc-daygrid-event {
border: none;
}
.fc .fc-scrollgrid-section table {
height: 50px;
}
.fc td,
.fc th {
vertical-align: middle;
}
.fc-v-event {
border-radius: 10px;
padding: 5px;
color: black;
}
.fc-scrollgrid-shrink {
height: 70px;
}
.fc .fc-timegrid-slot-label {
height: 50px;
}
.fc-timegrid-event .fc-event-time {
font-size: 1rem;
color: #727272;
}
.fc-direction-ltr .fc-daygrid-event .fc-event-time {
font-size: 1rem;
color: #727272;
}
.fc-timegrid-event .fc-event-title {
font-size: 1.2rem;
color: black;
}
.fc-daygrid-block-event .fc-event-title {
font-size: 1rem;
color: black;
}
.fc-event-main-frame {
border-radius: 20px;
}