Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] weekly 퍼블리싱 #56

Merged
merged 23 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2a763d4
feat: fullCalendar 라이브러리 설치
seong-hui Jul 5, 2024
1675ab7
style: fullcalendar css custom
seong-hui Jul 5, 2024
8afe2cf
feat: en dateTimeFormat
seong-hui Jul 5, 2024
f2798f1
style: 캘린더 버튼 style 설정
seong-hui Jul 6, 2024
f491f02
style: calendar font-size 변경
seong-hui Jul 6, 2024
2db3645
style: button 간격 수정
seong-hui Jul 6, 2024
64785dc
style: day에서는 주말 배경색 변경 안되게 하기
seong-hui Jul 6, 2024
c386be5
feat: 주간, 월간에 따라 dayHeaderContent 변경
seong-hui Jul 7, 2024
108c302
feat: 일간, 주간, 월간, 레이아웃 구현
seong-hui Jul 7, 2024
bd472f9
feat: 타입별 날짜 보여주기 분기
seong-hui Jul 7, 2024
3a2af89
feat: 종일 이벤트, 시간 이벤트 색 구별
seong-hui Jul 7, 2024
34fc29c
fix: 종일, 그외 이벤트 구별해서 스타일 적용
seong-hui Jul 7, 2024
baa1b12
feat: 상단 날짜표시 컴포넌트 분리
seong-hui Jul 7, 2024
f7b9b51
feat: 동기화 버튼 추가
seong-hui Jul 7, 2024
5453d25
feat: 달력 날짜에서 일빼고 숫자만 넣는 기능 구현
seong-hui Jul 7, 2024
c169e36
feat: 이벤트 시간 형식 변경
seong-hui Jul 8, 2024
e25177e
style: 캘린더 색상 theme 적용
seong-hui Jul 8, 2024
064d8a0
fix: 폴더구조 및 이름 변경
seong-hui Jul 8, 2024
3ed6623
delete: 중복 동기화 아이콘 삭제
seong-hui Jul 8, 2024
93ba7c2
style: 기본 버튼 색상 변경
seong-hui Jul 8, 2024
81c2c10
fix: style props로 색상변경 로직 수정
seong-hui Jul 8, 2024
ab0870b
fix: theme 적용
seong-hui Jul 8, 2024
a410971
fix: fullcalendar util함수 분리
seong-hui Jul 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
"dependencies": {
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@fullcalendar/react": "^6.1.14",
"@svgr/cli": "^8.1.0",
"fullcalendar": "^6.1.14",
"react": "^18.3.1",
"react-datepicker": "^7.2.0",
"react-dom": "^18.3.1",
Expand Down
2 changes: 2 additions & 0 deletions src/components/common/button/RefreshBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const RefreshBtnCss = css`
`;

const RefreshBtnLayout = styled.button<{ isDisabled: boolean }>`
z-index: 2;

${RefreshBtnCss}
color: ${({ theme, isDisabled }) => (isDisabled ? theme.palette.Grey.Grey5 : theme.palette.Grey.White)};

Expand Down
50 changes: 50 additions & 0 deletions src/components/common/fullCalendar/DayHeaderContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import styled from '@emotion/styled';
import { DayHeaderContentArg } from '@fullcalendar/core';

interface DayHeaderContentProps {
arg: DayHeaderContentArg;
currentView: string;
today: string;
}

function DayHeaderContent({ arg, currentView, today }: DayHeaderContentProps) {
const isTimeGridDay = currentView === 'timeGridDay';
const day = new Intl.DateTimeFormat('en-US', { weekday: isTimeGridDay ? 'long' : 'short' }).format(arg.date);
const date = arg.date.getDate();
const isToday = arg.date.toDateString() === today;

return (
<div>
{!isTimeGridDay ? (
<>
<WeekDay isToday={isToday}>{day}</WeekDay>
{currentView !== 'dayGridMonth' && <WeekDate isToday={isToday}>{date}</WeekDate>}
</>
) : (
<DayLayout>
<WeekDate isToday={false}>{date}일</WeekDate> <WeekDay isToday={false}>{day}</WeekDay>
</DayLayout>
)}
</div>
);
}

const DayLayout = styled.div`
display: flex;
gap: 1.2rem;
align-items: flex-end;
margin-left: 0.8rem;
`;

const WeekDay = styled.div<{ isToday: boolean }>`
${({ theme }) => theme.fontTheme.CAPTION_02};
color: ${({ isToday, theme }) => (isToday ? theme.palette.Blue.Blue11 : theme.palette.Grey.Grey6)};
text-transform: uppercase;
`;

const WeekDate = styled.div<{ isToday: boolean }>`
${({ theme }) => theme.fontTheme.HEADLINE_01};
color: ${({ isToday, theme }) => (isToday ? theme.palette.Primary : theme.palette.Grey.Black)};
`;

export default DayHeaderContent;
108 changes: 108 additions & 0 deletions src/components/common/fullCalendar/FullCalendarBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import styled from '@emotion/styled';
import { ViewMountArg, DatesSetArg } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
import interactionPlugin from '@fullcalendar/interaction';
import FullCalendar from '@fullcalendar/react';
import timeGridPlugin from '@fullcalendar/timegrid';
import { useState } from 'react';

import RefreshBtn from '@/components/common/button/RefreshBtn';
import DayHeaderContent from '@/components/common/fullCalendar/DayHeaderContent';
import FullCalendarLayout from '@/components/common/fullCalendar/FullCalendarStyle';
import { customDayCellContent, customSlotLabelContent } from '@/components/common/fullCalendar/fullCalendarUtils';
import { theme } from '@/styles/theme';

interface FullCalendarBoxProps {
size: 'small' | 'big';
}

function FullCalendarBox({ size }: FullCalendarBoxProps) {
const today = new Date().toDateString();
const [currentView, setCurrentView] = useState('timeGridWeek');

const handleViewChange = (view: ViewMountArg) => {
setCurrentView(view.view.type);
};

const handleDatesSet = (dateInfo: DatesSetArg) => {
setCurrentView(dateInfo.view.type);
};

return (
<FullCalendarLayout size={size}>
<CustomButtonContainer>
<RefreshBtn isDisabled={false} />
</CustomButtonContainer>
<FullCalendar
initialView="timeGridWeek"
plugins={[timeGridPlugin, dayGridPlugin, interactionPlugin]}
headerToolbar={{
left: 'title today prev next timeGridDay,timeGridWeek,dayGridMonth',
right: '',
}}
views={{
timeGridDay: {
titleFormat: { year: 'numeric', month: 'short' },
},
timeGridWeek: {
titleFormat(date) {
return `${date.date.year}년 ${date.date.month + 1}월`;
},
},
dayGridMonth: {
titleFormat: { year: 'numeric', month: 'short' },
},
}}
slotDuration="00:30:00"
editable
selectable
nowIndicator
dayMaxEvents
events={[
{ title: 'Meeting', start: '2024-07-06T10:00:00', end: '2024-07-06T12:00:00' },
{ title: 'Lunch', start: '2024-07-07T12:00:00', end: '2024-07-07T12:45:00' },
{ title: 'Lunch', start: '2024-07-08T12:00:00', end: '2024-07-08T12:30:00' },
{ title: 'All Day Event', start: '2024-07-08T10:00:00', end: '2024-07-08T12:00:00', allDay: true },
]}
Comment on lines +56 to +66
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용할때는 이 부분은 props로 받아서 처리하는건가요???

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네넹 이 부분은 Props로 받아서 처리하면 됩니당!

eventColor={theme.palette.Blue.Blue2}
buttonText={{
today: '오늘',
month: '월간',
week: '주간',
day: '일간',
}}
allDayText="종일"
locale="ko"
slotLabelFormat={{
hour: 'numeric',
minute: '2-digit',
meridiem: 'short',
hour12: true,
}}
slotLabelContent={customSlotLabelContent}
/* eslint-disable */
dayHeaderContent={(arg) => <DayHeaderContent arg={arg} currentView={currentView} today={today} />}
viewDidMount={handleViewChange}
datesSet={handleDatesSet}
dayCellContent={customDayCellContent}
eventTimeFormat={{
hour: 'numeric',
minute: '2-digit',
hour12: false,
}}
/>
</FullCalendarLayout>
);
}

const CustomButtonContainer = styled.div`
display: flex;
align-items: center;
justify-content: flex-end;
box-sizing: border-box;
width: 100%;
margin-bottom: -2.6rem;
padding-right: 1rem;
`;

export default FullCalendarBox;
Loading
Loading