Skip to content

Commit c0d3938

Browse files
authored
Merge pull request #142 from imaginer-dev/127--ui--calendarmain
2 parents 48c0196 + 7813113 commit c0d3938

File tree

6 files changed

+91
-12
lines changed

6 files changed

+91
-12
lines changed

โ€Žsrc/App.tsxโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function App() {
2727
</label>
2828
</div>
2929
<div className="flex-1">
30-
<h1 className="base-200 min-w-40 p-2 text-center">๊ฐœ์ธ ์ผ์ • ์บ˜๋ฆฐ๋”</h1>
30+
<h1 className="flex-end min-w-40 rounded bg-base-200 p-2 text-center text-sm">๊ฐœ์ธ ์ผ์ • ์บ˜๋ฆฐ๋”</h1>
3131
</div>
3232
</div>
3333
</div>

โ€Žsrc/components/common/Calendar.tsxโ€Ž

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,50 @@ export function Calendar() {
3131
}
3232
};
3333

34+
// eslint-disable-next-line react-hooks/exhaustive-deps
35+
const updateSize = () => {
36+
const isMobile = window.innerWidth < 768;
37+
setCalendarHeight(isMobile ? 500 : 'auto');
38+
updateTitle();
39+
};
40+
41+
const updateTitle = () => {
42+
const calendarApi = calendarRef?.current?.getApi();
43+
if (calendarApi) {
44+
const calendarView = calendarApi.view;
45+
46+
const date = new Date(calendarView.currentStart);
47+
const year = date.getFullYear();
48+
const month = (date.getMonth() + 1).toString().padStart(2, '0');
49+
const newTitle = `${year}.${month}`;
50+
51+
const titleElement = document.querySelector('.fc-toolbar-title');
52+
if (titleElement) {
53+
titleElement.textContent = newTitle;
54+
}
55+
}
56+
};
57+
3458
useEffect(() => {
35-
const updateSize = () => {
36-
const isMobile = window.innerWidth < 768;
37-
setCalendarHeight(isMobile ? 500 : 'auto');
38-
};
59+
const calendarApi = calendarRef?.current?.getApi();
60+
61+
if (calendarApi) {
62+
calendarApi.on('datesSet', updateTitle);
63+
}
64+
65+
updateTitle(); // ์ปดํฌ๋„ŒํŠธ ๋งˆ์šดํŠธ ์‹œ ์ œ๋ชฉ ์—…๋ฐ์ดํŠธ
3966

67+
/* ์บ˜๋ฆฐ๋” - ๋ฐ˜์‘ํ˜• ์‚ฌ์ด์ฆˆ */
4068
window.addEventListener('resize', updateSize);
41-
updateSize();
69+
updateSize(); // ์ปดํฌ๋„ŒํŠธ ๋งˆ์šดํŠธ ์‹œ ํ™”๋ฉด ํฌ๊ธฐ์— ๋”ฐ๋ฅธ ์—…๋ฐ์ดํŠธ
4270

43-
return () => window.removeEventListener('resize', updateSize);
44-
}, []);
71+
return () => {
72+
window.removeEventListener('resize', updateSize);
73+
if (calendarApi) {
74+
calendarApi.off('datesSet', updateTitle);
75+
}
76+
};
77+
}, [updateSize]);
4578

4679
return (
4780
<div>
@@ -58,6 +91,10 @@ export function Calendar() {
5891
titleFormat={{
5992
year: 'numeric',
6093
month: '2-digit',
94+
}}
95+
eventTimeFormat={{
96+
hour: '2-digit',
97+
minute: '2-digit',
6198
meridiem: false,
6299
}}
63100
dayHeaderFormat={{
@@ -70,11 +107,9 @@ export function Calendar() {
70107
}}
71108
customButtons={{
72109
prevButton: {
73-
icon: 'chevron-left',
74110
click: handlePrev,
75111
},
76112
nextButton: {
77-
icon: 'chevron-right',
78113
click: handleNext,
79114
},
80115
}}
@@ -93,8 +128,10 @@ interface EventInfo {
93128
function renderEventContent(eventInfo: EventInfo) {
94129
return (
95130
<>
96-
<b>{eventInfo.timeText}</b>
97-
<i>{eventInfo.event.title}</i>
131+
<div className="w-full border-0 bg-secondary p-0.5 text-white">
132+
<b className="border-0">{eventInfo.timeText}</b>
133+
<i> {eventInfo.event.title}</i>
134+
</div>
98135
</>
99136
);
100137
}
563 Bytes
Loading
553 Bytes
Loading

โ€Žsrc/styles/index.cssโ€Ž

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@tailwind components;
33
@tailwind utilities;
44

5+
56
.userInvite {
67
display: flex;
78
justify-content: center;
@@ -32,3 +33,39 @@
3233
visibility: visible;
3334
}
3435
}
36+
37+
@layer base {
38+
@font-face {
39+
font-family: 'Pretendard-Regular';
40+
src: url('https://fastly.jsdelivr.net/gh/Project-Noonnu/[email protected]/Pretendard-Regular.woff') format('woff');
41+
font-weight: 400;
42+
font-style: normal;
43+
}
44+
}
45+
46+
/* ์บ˜๋ฆฐ๋” - ํ™”์‚ดํ‘œ ์•„์ด์ฝ˜ */
47+
.fc .fc-button-primary:hover {
48+
background-color: var(--fc-event-text-color);
49+
}
50+
.fc .fc-prevButton-button {
51+
background-color: transparent;
52+
border: 0;
53+
background-image: url('../img/icon_arrow_left.png');
54+
width: 20px;
55+
height: 20px;
56+
display: block;
57+
background-size: contain;
58+
}
59+
.fc .fc-nextButton-button {
60+
background-color: transparent;
61+
border: 0;
62+
background-image: url('../img/icon_arrow_right.png');
63+
width: 20px;
64+
height: 20px;
65+
display: block;
66+
background-size: contain;
67+
}
68+
/* ์บ˜๋ฆฐ๋” - ์ผ์ •์ปฌ๋Ÿฌ */
69+
.fc .fc-h-event {
70+
border: var(--fc-event-text-color);
71+
}

โ€Žtailwind.config.jsโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ export default {
66
content: ['./index.html', './src/**/*.{js,ts,jsx,tsx}'],
77
theme: {
88
extend: {},
9+
fontFamily: {
10+
sans: ['Pretendard-Regular', 'sans-serif'],
11+
serif: ['Pretendard-Regular', 'sans-serif'],
12+
mono: ['Pretendard-Regular', 'sans-serif'],
13+
},
914
},
1015

1116
daisyui: {

0 commit comments

Comments
ย (0)