Skip to content

Commit

Permalink
feat: 달력 라이브러리 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
ShinjungOh committed Aug 7, 2024
1 parent a8e087e commit 3c1d19b
Show file tree
Hide file tree
Showing 6 changed files with 377 additions and 19 deletions.
107 changes: 107 additions & 0 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"framer-motion": "^11.2.10",
"ip-address": "^9.0.5",
"react": "^18.2.0",
"react-calendar": "^5.0.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.51.5",
"react-router-dom": "^6.23.1",
Expand Down
63 changes: 44 additions & 19 deletions src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
import { useState } from 'react';
import { Box } from '@chakra-ui/react';
import { Body } from '@/shared';
import Calendar from 'react-calendar';
import 'react-calendar/dist/Calendar.css';
import '@/shared/components/Calendar/CustomCalendar.css';
import { Body, HomeAside } from '@/shared';
import { Nav } from '@/shared/components/Nav';
import { NoteList } from '@/shared/components/NoteList';

export const Home = () => (
<>
<Nav />
<Body>
<Box
style={{
margin: 0,
padding: '0 47px',
paddingRight: '35px',
width: '100%',
}}
>
<h1>home</h1>
<NoteList />
</Box>
</Body>
</>
);
export const Home = () => {
const [date, setDate] = useState(new Date());

const onChangeDate = (newDate: Date) => {
setDate(newDate);
};

return (
<>
<Nav />
<Body>
<Box
style={{
margin: 0,
padding: '0 47px',
paddingRight: '35px',
width: '100%',
}}
>
<h1>home</h1>
<NoteList />
</Box>
</Body>
<HomeAside>
<Calendar
prev2Label={null}
next2Label={null}
formatDay={(_, date) => date.getDate().toString()}
calendarType="gregory"
value={date}
onChange={onChangeDate}
style={{
border: 'none',
}}
/>
</HomeAside>
</>
);
};
139 changes: 139 additions & 0 deletions src/shared/components/Calendar/CustomCalendar.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
.react-calendar,
.react-calendar *,
.react-calendar *:before,
.react-calendar *:after {
border: none;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}


.react-calendar button:enabled:hover {
cursor: pointer;
}

.react-calendar__navigation {
display: flex;
height: 44px;
margin-bottom: 1em;
}

.react-calendar__navigation button {
min-width: 44px;
background: none;
}

.react-calendar__navigation button:disabled {
background-color: #f0f0f0;
}

.react-calendar__navigation button:enabled:hover,
.react-calendar__navigation button:enabled:focus {
background-color: unset;
}

.react-calendar__month-view__weekdays {
text-align: center;
text-transform: uppercase;
font: inherit;
font-size: 0.75em;
font-weight: bold;
}

.react-calendar__month-view__weekdays__weekday {
padding: 0.5em;
}

.react-calendar__month-view__weekNumbers .react-calendar__tile {
display: flex;
align-items: center;
justify-content: center;
font: inherit;
font-size: 0.75em;
font-weight: bold;
}

.react-calendar__month-view__days__day--weekend {
color: #FF003E;
}

.react-calendar__month-view__days__day--neighboringMonth,
.react-calendar__decade-view__years__year--neighboringDecade,
.react-calendar__century-view__decades__decade--neighboringCentury {
color: unset;
}

.react-calendar__year-view .react-calendar__tile,
.react-calendar__decade-view .react-calendar__tile,
.react-calendar__century-view .react-calendar__tile {
padding: 2em 0.5em;
}

.react-calendar__tile {
max-width: 100%;
padding: 10px 6.6667px;
background: none;
text-align: center;
line-height: 16px;
font: inherit;
font-size: 0.833em;
}

.react-calendar__tile:disabled {
background-color: unset;
}

.react-calendar__month-view__days__day--neighboringMonth:disabled,
.react-calendar__decade-view__years__year--neighboringDecade:disabled,
.react-calendar__century-view__decades__decade--neighboringCentury:disabled {
color: #cdcdcd;
}

.react-calendar__tile:enabled:hover,
.react-calendar__tile:enabled:focus {
background-color: unset;
}

.react-calendar__tile--now {
background: #E3E3E3;
border-radius: 50%;
}

.react-calendar__tile--now:enabled:hover {
background: #E3E3E3;
border-radius: 50%;
}

.react-calendar__tile--now:enabled:focus {
background: #E3E3E3;
border-radius: 50%;
}

.react-calendar__tile--hasActive {
background: #E3E3E3;
/*border-radius: 0;*/
}

.react-calendar__tile--hasActive:enabled:hover,
.react-calendar__tile--hasActive:enabled:focus {
background: #E3E3E3;
border-radius: 50%;
}

.react-calendar__tile--active {
background: #131313;
border-radius: 50%;
color: white;
}

.react-calendar__tile--active:enabled:hover,
.react-calendar__tile--active:enabled:focus {
background: #131313;
border-radius: 50%;
}

.react-calendar--selectRange .react-calendar__tile--hover {
background-color: #e6e6e6;
border-radius: 0;
}
Loading

0 comments on commit 3c1d19b

Please sign in to comment.