-
Notifications
You must be signed in to change notification settings - Fork 2
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] 캘린더 v2 변경 #328
Open
Kjiw0n
wants to merge
19
commits into
develop
Choose a base branch
from
feat/#322/calendar-v2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[FEAT] 캘린더 v2 변경 #328
Changes from 17 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
a44cfd9
style: 주/월 토글 스타일 변경
Kjiw0n 54a4a25
refactor: change fullcalendar title to MainDate
Kjiw0n 23e3567
style: calendar toolbar 재배치 및 스타일링 변경
Kjiw0n 422701b
fix: 오타 수정(isCusor -> isCursor)
Kjiw0n 334eeae
refactor: add Calendar, Filter icon
Kjiw0n 8e3a45f
refactor: 날짜/요일 스타일링 변경
Kjiw0n 0e81f20
feat: change duration 15min & styling
Kjiw0n 9d788af
style: 캘린더 박스 조정
Kjiw0n 8981934
feat: calendar size에 따라 주간캘린더 duration 조정
Kjiw0n 5f6a4ba
refactor: 주간캘린더 DayHeaderContent 날짜 조정
Kjiw0n 369d8cd
style: monthGrid일 때 날짜 hover/pressed styling
Kjiw0n 705cb3d
fix: 변수명 오타 수정(isCusor -> isCursor)
Kjiw0n b3ec6de
fix: 월캘린더일때는 날짜조정x
Kjiw0n 592006c
style: 스타일 조정
Kjiw0n 79b9b7a
style: 아이콘 정렬 개선 및 button active 스타일 추가
Kjiw0n f9d9cb1
feat: 월간뷰 스크롤 제거
Kjiw0n ac3a5c0
style: 주간캘린더 border-radius 미적용
Kjiw0n 31ea093
style: 캘린더 토글 radius 오류 수정
Kjiw0n 51352e5
style: 캘린더 width 개선
Kjiw0n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import styled from '@emotion/styled'; | ||
|
||
import IconButton from '../v2/IconButton'; | ||
import MainDate from '../v2/TextBox/MainDate'; | ||
|
||
type Props = { | ||
size: 'small' | 'big'; | ||
date: { year: number; month: number }; | ||
}; | ||
|
||
function CalendarHeader({ size, date }: Props) { | ||
return ( | ||
<CalendarHeaderContainer size={size}> | ||
<MainDate year={date.year} month={date.month} /> | ||
<CalendarHeaderWrapper> | ||
<IconButton type="normal" size="small" iconName="IcnCalendar" /> | ||
<IconButton type="normal" size="small" iconName="IcnFilter" /> | ||
</CalendarHeaderWrapper> | ||
</CalendarHeaderContainer> | ||
); | ||
} | ||
|
||
export default CalendarHeader; | ||
|
||
const CalendarHeaderContainer = styled.div<{ size: string }>` | ||
position: absolute; | ||
top: 56px; | ||
display: flex; | ||
align-items: flex-start; | ||
justify-content: space-between; | ||
box-sizing: border-box; | ||
width: 100%; | ||
height: auto; | ||
padding: ${({ size }) => (size === 'big' ? '0 2.4rem;' : '0 1.6rem 0 2.4rem;')}; | ||
`; | ||
|
||
const CalendarHeaderWrapper = styled.div` | ||
display: flex; | ||
gap: 194px; | ||
margin-top: 0.2rem; | ||
|
||
color: ${({ theme }) => theme.colorToken.Icon.normal}; | ||
`; |
127 changes: 127 additions & 0 deletions
127
src/components/common/fullCalendar/CustomDayCellContent.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* eslint-disable no-nested-ternary */ | ||
import { css } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
import { DayCellContentArg } from '@fullcalendar/core'; | ||
import { useState } from 'react'; | ||
|
||
import { theme } from '@/styles/theme'; | ||
|
||
const TYPE = { | ||
TERITARY: 'Teritary', | ||
SECONDARY: 'Secondary', | ||
PRIMARY: 'Primary', | ||
} as const; | ||
|
||
const STATE = { | ||
DEFAULT: 'Default', | ||
HOVER: 'Hover', | ||
PRESSED: 'Pressed', | ||
} as const; | ||
|
||
type StateType = (typeof STATE)[keyof typeof STATE]; | ||
|
||
interface CustomDayCellContentProps { | ||
arg: DayCellContentArg; | ||
today: string; | ||
selectDate?: string; | ||
} | ||
|
||
// 월간 달력에서 날짜 '일' 제거 및 스타일링 적용 | ||
function CustomDayCellContent({ arg, today, selectDate }: CustomDayCellContentProps) { | ||
const date = new Date(arg.date); | ||
const day = arg.dayNumberText.replace('일', ''); | ||
const isSelectedDate = date.toDateString() === selectDate; | ||
const isToday = date.toDateString() === today; | ||
const [state, setState] = useState<StateType>(STATE.DEFAULT); | ||
|
||
const type = isToday ? TYPE.PRIMARY : isSelectedDate ? TYPE.SECONDARY : TYPE.TERITARY; | ||
|
||
const handleStateChange = (newState: StateType) => () => { | ||
setState(newState); | ||
}; | ||
|
||
if (arg.view.type === 'dayGridMonth') { | ||
return ( | ||
<MonthViewDate | ||
type={type} | ||
state={state} | ||
onMouseEnter={handleStateChange(STATE.HOVER)} | ||
onMouseLeave={handleStateChange(STATE.DEFAULT)} | ||
onMouseDown={handleStateChange(STATE.PRESSED)} | ||
onMouseUp={handleStateChange(STATE.DEFAULT)} | ||
isSelectedDate={isSelectedDate} | ||
isToday={isToday} | ||
> | ||
{arg.view.type === 'dayGridMonth' ? day : ''} | ||
</MonthViewDate> | ||
); | ||
} | ||
} | ||
|
||
export default CustomDayCellContent; | ||
|
||
const backgroundStyles = { | ||
Teritary: { | ||
Default: 'transparent', | ||
Hover: theme.colorToken.Primary.strongVariant, | ||
Pressed: theme.colorToken.Primary.heavyVariant, | ||
}, | ||
Secondary: { | ||
Default: 'transparent', | ||
Hover: theme.colorToken.Primary.strongVariant, | ||
Pressed: theme.colorToken.Component.heavy, | ||
}, | ||
Primary: { | ||
Default: theme.colorToken.Primary.normal, | ||
Hover: theme.colorToken.Primary.strong, | ||
Pressed: theme.colorToken.Primary.heavy, | ||
}, | ||
}; | ||
|
||
const textStyles = { | ||
Teritary: theme.colorToken.Text.neutralLight, | ||
Secondary: theme.colorToken.Text.primary, | ||
Primary: theme.colorToken.Text.neutralDark, | ||
}; | ||
|
||
const MonthViewDate = styled.div<{ | ||
type: keyof typeof backgroundStyles; | ||
state: keyof (typeof backgroundStyles)['Teritary']; | ||
isSelectedDate: boolean; | ||
isToday: boolean; | ||
}>` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 2.4rem; | ||
height: 2.4rem; | ||
|
||
border-radius: 6px; | ||
|
||
${({ theme }) => theme.font.label03}; | ||
|
||
${({ type, state }) => css` | ||
color: ${textStyles[type]}; | ||
|
||
background-color: ${backgroundStyles[type][state]}; | ||
|
||
${type === TYPE.SECONDARY && underlineStyle} | ||
`} | ||
`; | ||
|
||
const underlineStyle = css` | ||
position: relative; | ||
|
||
&::after { | ||
position: absolute; | ||
bottom: 2px; | ||
left: 50%; | ||
width: 3.2rem; | ||
height: 0.1rem; | ||
|
||
background-color: ${theme.colorToken.Text.primary}; | ||
transform: translateX(-50%); | ||
|
||
content: ''; | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,55 @@ | ||
/* eslint-disable no-nested-ternary */ | ||
import styled from '@emotion/styled'; | ||
import { DayHeaderContentArg } from '@fullcalendar/core'; | ||
|
||
import SubDate from '../v2/TextBox/SubDate'; | ||
|
||
interface DayHeaderContentProps { | ||
arg: DayHeaderContentArg; | ||
currentView: string; | ||
today: string; | ||
selectDate?: string; | ||
size: string; | ||
} | ||
|
||
function DayHeaderContent({ arg, currentView, today }: DayHeaderContentProps) { | ||
function DayHeaderContent({ arg, currentView, today, selectDate, size }: DayHeaderContentProps) { | ||
let adjustDay = size === 'big' ? 3 : 2; | ||
if (currentView === 'dayGridMonth') { | ||
adjustDay = 0; | ||
} | ||
const adjustedDate = new Date(arg.date); | ||
adjustedDate.setDate(adjustedDate.getDate() - adjustDay); | ||
|
||
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; | ||
const day = new Intl.DateTimeFormat('ko', { weekday: isTimeGridDay ? 'long' : 'short' }).format(adjustedDate); | ||
const date = adjustedDate.getDate(); | ||
const isSelectedDate = adjustedDate.toDateString() === selectDate; | ||
const isToday = adjustedDate.toDateString() === today; | ||
const isSatday = day === '토'; | ||
const isSunday = day === '일'; | ||
|
||
return ( | ||
<div> | ||
{!isTimeGridDay ? ( | ||
<> | ||
<WeekDay isToday={isToday}>{day}</WeekDay> | ||
{currentView !== 'dayGridMonth' && <WeekDate isToday={isToday}>{date}</WeekDate>} | ||
</> | ||
{currentView === 'dayGridMonth' ? ( | ||
<WeekDay isSatday={isSatday} isSunday={isSunday}> | ||
{day} | ||
</WeekDay> | ||
) : ( | ||
<DayLayout> | ||
<WeekDate isToday={false}>{date}일</WeekDate> <WeekDay isToday={false}>{day}</WeekDay> | ||
</DayLayout> | ||
<SubDate | ||
day={date.toString()} | ||
weekDay={day.toString()} | ||
type={isToday ? 'Primary' : isSelectedDate ? 'Secondary' : 'Teritary'} | ||
/> | ||
)} | ||
</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)}; | ||
const WeekDay = styled.div<{ isSatday: boolean; isSunday: boolean }>` | ||
${({ theme }) => theme.font.label04}; | ||
color: ${({ isSatday, isSunday, theme }) => | ||
isSatday ? theme.color.Blue.Blue7 : isSunday ? theme.color.Orange.Orange5 : theme.color.Grey.Grey5}; | ||
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; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제 pc 상에서만 깨지는 거일 가능성이 높은데요..(pr에는 잘 보여서)
요거 정렬 혹시 왜 이럴까유,, 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오잉 이 부분은
SubDate
컴포넌트 사용한건데, 혹시 이전 pr 확인하실때에도 이런 문제 있으셨을까요????스토리북 확인해도 중앙에 맞게 떠서.. 글씨체 먹었는 지 확인 부탁드립니다