import React, { useState, useEffect, useRef } from 'react'; import Calendar from '@toast-ui/react-calendar'; import "tui-calendar/dist/tui-calendar.css"; import "tui-date-picker/dist/tui-date-picker.css"; import "tui-time-picker/dist/tui-time-picker.css"; function Cal(calledday) { const calendarRef = useRef(); const [day, setDay] = useState(calledday); const [myTheme, setMyTheme] = useState({ 'common.dayname.color': '#333', 'common.today.color': '#333', // 'common.creationGuide.color': 'white', 'common.creationGuide.backgroundColor': 'gray', // Theme object to extends default dark theme. }); function getDataAction(target) { return target.dataset ? target.dataset.action : target.getAttribute('data-action'); } function onClickNavi(e) { const cal = calendarRef.current.getInstance(); const action = getDataAction(e.target); switch (action) { case 'move-prev': cal.prev(); break; case 'move-next': cal.next(); break; case 'move-today': cal.today(); break; default: return; } // setRenderRangeText(); // setSchedules(); } function useday(day) { const cal = calendarRef.current.getInstance(); cal.setDate(new Date(day)); cal.changeView('week', true); cal.today(new Date(day)); } useEffect(() => { // const cal = calendarRef.current.getInstance(); // cal.setDate(new Date(day)); // cal.changeView('week', false); // cal.today(new Date(day)); // calendar.on('clickSchedule', function (event) { // const schedule = event.schedule; // if (lastClickSchedule) { // calendar.updateSchedule(lastClickSchedule.id, lastClickSchedule.calendarId, { // isFocused: false, // }); // } // calendar.updateSchedule(schedule.id, schedule.calendarId, { // isFocused: true, // }); // lastClickSchedule = schedule; // // open detail view // return (console.log(isFocused)) // }); }, [day]) return (
) } export default Cal