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/FE] 005 006 환자 비대면 진료 예약 페이지 + 모달 컴포넌트 구현을 진행한다. #18

Merged
merged 10 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
142 changes: 142 additions & 0 deletions package-lock.json

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

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"@reduxjs/toolkit": "^1.9.5",
"axios": "^1.5.0",
"classnames": "^2.3.2",
"dayjs": "^1.11.10",
"js-cookie": "^3.0.5",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-calendar": "^4.6.0",
"react-dom": "^18.2.0",
"react-icons": "^4.10.1",
"react-paginate": "^8.2.0",
Expand Down
2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import SignupPage from "./pages/SignupPage.jsx";
import MyUserPage from './pages/User/MyUserPage.jsx';
import DevelopPage from './pages/DevelopPage.jsx';
import UserUntactReservePage from './pages/User/UserUntactReservePage.jsx';
import UserReservePage from './pages/User/UserReservePage.jsx';
import styled from "styled-components";
import "./App.scss";

Expand All @@ -22,6 +23,7 @@ function App() {
<Route path="/" element={<DevelopPage />} />
<Route path="/userdash" element={<MyUserPage/>}/>
<Route path="/useruntactreserve" element={<UserUntactReservePage/>} />
<Route path="/userreserve" element={<UserReservePage />} />
</Routes>
</Container>
</Router>
Expand Down
Binary file added src/assets/icons/iconmajor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/icons/iconx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/Button/BackButton.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const BackButtonContainer = styled.button`
align-items: center;
justify-content: center;
padding: 0 15px;
margin-top:60px;
margin-top:40px;
margin-bottom: 10px;
margin-left: -580px;
`;
Expand Down
88 changes: 88 additions & 0 deletions src/components/Calender/Calender.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
import { useState } from "react";
import styled from "styled-components";
import dayjs from 'dayjs';
import CalenderItem from "../Calender/CalenderItem.jsx";
import IconLeft from "../../assets/icons/Page-left.png";
import IconRight from "../../assets/icons/Page-right.png";

const SelectorContainer = styled.div`
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 10px;
`;

const Icon = styled.img`
cursor: pointer;
margin: 0 10px;
`;

const MonthLabel = styled.span`
font-size: 1.2rem;
`;

const Container = styled.div`
width: 100%;
display: grid;
grid-template-columns: repeat(7, 50px);
grid-gap: 6px;
grid-template-rows: repeat(6, 40px);
justify-content: center;
align-items: center;
`;

const Calender = () => {
const [selectedMonth, setSelectedMonth] = useState(8);
const [selectedDate, setSelectedDate] = useState(null);

const prevMonth = () => {
if (selectedMonth > 8) setSelectedMonth(prev => prev - 1);
};

const nextMonth = () => {
if (selectedMonth < 11) setSelectedMonth(prev => prev + 1);
};

const daysInCurrentMonth = dayjs([2023, selectedMonth]).daysInMonth();
const startDayOfWeek = dayjs([2023, selectedMonth, 1]).day();

let days = [];
for (let i = 1; i <= daysInCurrentMonth; i++) {
days.push(i);
}

const paddingDays = startDayOfWeek;
for (let i = 0; i < paddingDays; i++) {
days.unshift(null);
}

while (days.length < 35) {
days.push(null);
}

return (
<>
<SelectorContainer>
<Icon src={IconLeft} alt="Previous Month" onClick={prevMonth} />
<MonthLabel>{`2023.${selectedMonth < 9 ? `${selectedMonth }` : selectedMonth }`}</MonthLabel>
<Icon src={IconRight} alt="Next Month" onClick={nextMonth} />
</SelectorContainer>
<Container>
{days.map((day, idx) => {
let type = day ? "currentMonth" : "paddingDay";
return (
<CalenderItem
key={idx}
date={day}
type={type}
isSelected={selectedDate === day && day !== null}
onSelectDate={setSelectedDate}
/>
);
})}
</Container>
</>
);
};

export default Calender;
Loading