Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8d3d0e4
[ fix ] eslint ๋ฌธ์ œ ํ•ด๊ฒฐ
seojisoosoo Jun 29, 2023
28373c4
[ feat ] react-calendar๋กœ ๋‹ฌ๋ ฅ ๋„์šฐ๊ธฐ ์„ฑ๊ณต
seojisoosoo Jun 30, 2023
41fe24e
[ feat ] ๋‹ฌ๋ ฅ ๋ฐ์ดํ„ฐ ์ƒ์ˆ˜ ํŒŒ์ผ ์ถ”๊ฐ€
seojisoosoo Jul 1, 2023
b6bf860
[ fix ] ํ—ˆ์Šคํ‚ค ์‚ญ์ œ
seojisoosoo Jul 1, 2023
0e8f660
[ feat ] ๋‹ฌ๋ ฅ ๋ผˆ๋Œ€ ๊ตฌํ˜„
seojisoosoo Jul 1, 2023
7ba45f1
[ etc ] ์ƒ์ˆ˜ ํŒŒ์ผ ์ˆ˜์ •
seojisoosoo Jul 1, 2023
d8520d1
[ feat ] ์ƒ์ˆ˜ ํŒŒ์ผ ๋ฐ์ดํ„ฐ ๋‹ฌ๋ ฅ์— ๋„์šฐ๊ธฐ ์„ฑ๊ณต
seojisoosoo Jul 1, 2023
6d9bc03
[ design ] ์ผ์ • ๋ฐ•์Šค ์Šคํƒ€์ผ๋ง
seojisoosoo Jul 1, 2023
b02ec96
[ etc ] ๋ถˆํ•„์š” ์ฝ”๋“œ ์‚ญ์ œ
seojisoosoo Jul 1, 2023
9e80de0
[ design ] ์บ˜๋ฆฐ๋” ์ œ๋ชฉ ์Šคํƒ€์ผ๋ง
seojisoosoo Jul 1, 2023
2e1eeb7
[ fix ] theme ์—๋Ÿฌ ์ˆ˜์ •
seojisoosoo Jul 1, 2023
17783d0
[ design ] ํƒ€์ผ ํฌ๊ธฐ ์กฐ์ •
seojisoosoo Jul 1, 2023
d8f0cef
[ feat ] ๋‹ฌ๋ ฅ ๋ฐ์ดํ„ฐ ํƒ€์ž…๊ณผ ๋‚ด์šฉ ์ˆ˜์ •
seojisoosoo Jul 1, 2023
c17127c
[ etc ] ์ƒ์ˆ˜ ํŒŒ์ผ ์˜ค๋ฅ˜ ์ˆ˜์ •
seojisoosoo Jul 1, 2023
f2fba41
[ etc ] ์ƒ์ˆ˜ ํŒŒ์ผ ์˜ค๋ฅ˜ ์ˆ˜์ •
seojisoosoo Jul 1, 2023
aeb619c
[ etc ] ์ƒ์ˆ˜ ํŒŒ์ผ ์˜ค๋ฅ˜ ์ˆ˜์ •
seojisoosoo Jul 1, 2023
b269711
[ etc ] ๋ถˆํ•„์š” ๋ผ๋ฒจ ์‚ญ์ œ
seojisoosoo Jul 1, 2023
f47728d
[ etc ] any ํƒ€์ž… ์‚ญ์ œ
seojisoosoo Jul 1, 2023
009b49b
[ reverse ] any ํƒ€์ž…๋˜๋Œ๋ฆฌ๊ธฐ
seojisoosoo Jul 1, 2023
c56d3cc
[ etc ] ๋ถˆํ•„์š” ์ฝ”๋“œ ์‚ญ์ œ
seojisoosoo Jul 1, 2023
6c84bb3
[ etc ] ๋ณ€์ˆ˜๋ช… ๋ณ€๊ฒฝ
seojisoosoo Jul 1, 2023
c199cb4
[ feat ] ํด๋ฆญ๋œ ๋‚ ์งœ ๋ณด์—ฌ์ง€๋„๋ก ๊ฐ’ ๊ฐ€์ ธ์˜ค๊ธฐ
seojisoosoo Jul 2, 2023
934d685
[ feat ] ๋ชจ๋‹ฌ ์ฐฝ ๊ตฌํ˜„
seojisoosoo Jul 2, 2023
ebed86e
[ feat ] ๋ชจ๋‹ฌ ๊ฐœํ ๊ตฌํ˜„
seojisoosoo Jul 2, 2023
46ca26e
[ style ] ๋ชจ๋‹ฌ ๊ฐœํ ํ•จ์ˆ˜ ๋‘ ๊ฐœ๋กœ ๋ถ„๋ฆฌ
seojisoosoo Jul 2, 2023
8f0b151
[ design ] ๋ชจ๋‹ฌ ์Šคํƒ€์ผ๋ง
seojisoosoo Jul 2, 2023
f4dbe23
[ etc ] ํŒจํ‚ค์ง€ ์„ค์น˜
seojisoosoo Jul 3, 2023
2360935
[ design ] ๋ฆฌ์•กํŠธ ํƒ€์ž„ํ”ผ์ปค ์Šคํƒ€์ผ๋ง
seojisoosoo Jul 3, 2023
4490e2e
[ feat ] ์‹œ์ž‘๊ณผ ๋์‹œ๊ฐ„ ๊ตฌํ˜„
seojisoosoo Jul 3, 2023
70e202f
[ design ] ํƒ€์ž„ํ”ผ์ปค ๋ชจ๋‹ฌ flex๋กœ ์œ„์น˜ ์ˆ˜์ •
seojisoosoo Jul 3, 2023
197258e
[ feat ] AM, PM์ธ์ง€์— ๋”ฐ๋ผ ์˜ค์ „, ์˜คํ›„ ๋‹ค๋ฅด๊ฒŒ ํ‘œ๊ธฐ๋˜๋„๋ก ๊ตฌํ˜„
seojisoosoo Jul 3, 2023
0e7a1f4
[ etc ] ๋ถˆํ•„์š” ์ฝ”๋“œ ์‚ญ์ œ ๋ฐ ํŒŒ์ผ ์ƒ์„ฑ
seojisoosoo Jul 3, 2023
0383644
[ design ] ์ทจ์†Œ ํ™•์ธ ์˜์–ด ํ•œ๊ตญ์–ด๋กœ ๋ณ€๊ฒฝ
seojisoosoo Jul 3, 2023
56a1794
[ feat ] ํ™•์ธ ๋ฒ„ํŠผ ๊ตฌํ˜„
seojisoosoo Jul 3, 2023
2566d3a
[ feat ] ํ•™์ƒ ์ด๋ฆ„ ์ž…๋ ฅ ๋ฒ„ํŠผ ๊ตฌํ˜„
seojisoosoo Jul 3, 2023
d870e24
[ feat ] ์บ˜๋ฆฐ๋” ๋ฐ์ดํ„ฐ ๋ณ€๊ฒฝ
seojisoosoo Jul 3, 2023
70b432c
[ feat ] ๋ณ€๊ฒฝ๋œ ๋ฐ์ดํ„ฐ๋กœ ๋‹ฌ๋ ฅ ๋ฐ์ดํ„ฐ ๋ฐ˜์˜
seojisoosoo Jul 3, 2023
0a8f84b
[ etc ] ๋ถˆํ•„์š” ์ฝ”๋“œ ์‚ญ์ œ
seojisoosoo Jul 3, 2023
2d4a356
[ feat ] ์ž…๋ ฅํ•œ ์‹œ๊ฐ„๋Œ€๋กœ ๋ฐ์ดํ„ฐ ์ถ”๊ฐ€๋˜๊ธฐ ๊ตฌํ˜„ ์„ฑ๊ณต
seojisoosoo Jul 3, 2023
47e9afc
[ style ] ๋‚ ์งœ ๋ณ€ํ™˜๋˜๋Š” ๋ฐฉ์‹ ๋ณ€๊ฒฝ
seojisoosoo Jul 3, 2023
f74e5e7
[ design ] ๊ธฐํƒ€ ์Šคํƒ€์ผ๋ง ์ˆ˜์ •
seojisoosoo Jul 3, 2023
7514965
[ style ] ๊ตฌ์กฐ๋ถ„ํ•ด ํ• ๋‹น ์‚ญ์ œ
seojisoosoo Jul 3, 2023
a22e758
[ refactor ] ํƒ€์ž… ์„ค์ •
seojisoosoo Jul 3, 2023
bb4e834
[ etc ] ํƒ€์ž… ์ˆ˜์ •
seojisoosoo Jul 3, 2023
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
4 changes: 2 additions & 2 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
"plugin:import/warnings",
"plugin:prettier/recommended",
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
// "prettier/@typescript-eslint",
],
rules: {
"linebreak-style": 0,
Expand All @@ -22,6 +22,6 @@ module.exports = {
"eol-last": ["error", "always"], // line์˜ ๊ฐ€์žฅ ๋งˆ์ง€๋ง‰ ์ค„์—๋Š” ๊ฐœํ–‰ ๋„ฃ๊ธฐ
"react/react-in-jsx-scope": "off",
"no-multi-spaces": "error", // ์ŠคํŽ˜์ด์Šค ์—ฌ๋Ÿฌ๊ฐœ ๊ธˆ์ง€
"simple-import-sort/imports": "error",
// "simple-import-sort/imports": "error",
},
};
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

17 changes: 17 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,27 @@
crossorigin="anonymous"
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/static/pretendard.css" />
<link href="https://webfontworld.github.io/kt/YDestreet.css" rel="stylesheet" />
<link rel="stylesheet" href="src/index.css" />
<title>web-pre-task</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script>
window.onload = function () {
document.querySelector(".react-ios-time-picker-cell-inner-hour-format-selected").innerHTML = "์˜ค์ „";
const sections = document.querySelectorAll(".react-ios-time-picker-cell-inner-hour-format");

console.log(sections);
console.log(sections.length);
for (let i = 0; i < sections.length; i++) {
if (i === 0) {
let item = sections.item(i);

item.innerHTML = "์˜ค์ „";
}
}
};
</script>
</body>
</html>
16 changes: 12 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,21 @@
"format": "prettier --write --cache ."
},
"dependencies": {
"antd": "^5.6.4",
"date-fns": "^2.30.0",
"dayjs": "^1.11.9",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-simple-import-sort": "^10.0.0",
"moment": "^2.29.4",
"react": "^18.2.0",
"react-calendar": "^4.3.0",
"react-datepicker": "^4.14.1",
"react-day-picker": "^8.8.0",
"react-dom": "^18.2.0",
"react-ios-time-picker": "^0.2.2",
"react-query": "^3.39.3",
"react-router-dom": "^6.14.0",
"recoil": "^0.7.7",
Expand All @@ -27,19 +35,19 @@
},
"devDependencies": {
"@types/react": "^18.0.37",
"@types/react-datepicker": "^4.11.2",
"@types/react-dom": "^18.0.11",
"@typescript-eslint/eslint-plugin": "^5.59.0",
"@typescript-eslint/parser": "^5.59.0",
"@typescript-eslint/eslint-plugin": "5",
"@typescript-eslint/parser": "5",
"@vitejs/plugin-react": "^4.0.1",
"eslint": "^8.38.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.3.4",
"husky": "^8.0.3",
"lint-staged": "^13.2.3",
"prettier": "^2.8.8",
"typescript": "^5.0.2",
"typescript": "^5.1.6",
"vite": "^4.3.9"
},
"lint-staged": {
Expand Down
Empty file removed src/components/.keep
Empty file.
Empty file removed src/components/jisoo/.keep
Empty file.
281 changes: 281 additions & 0 deletions src/components/jisoo/JisooCalendar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
import moment from "moment";
import { useState } from "react";
import Calendar from "react-calendar";
import "react-calendar/dist/Calendar.css";
import { TimePicker } from "react-ios-time-picker";
import { styled } from "styled-components";
import { CAELENDAR_DATA } from "../../core/jisoo/calendarData";
import { calendarDatatTypes } from "../../type/jisoo/calendarDataTypes";

export default function JisooCalendar() {
const [value, onChange] = useState(new Date());
const [classData, setClassData] = useState<calendarDatatTypes[]>(CAELENDAR_DATA);
const [openModal, setOpenModal] = useState<boolean>(false);
const [startTimeValue, setStartTimeValue] = useState("10:00 AM");
const [endTimeValue, setEndTimeValue] = useState("11:00 AM");
const [studentName, setStudentName] = useState("");

function handleChangeStartTimeValue(timeValue: string) {
setStartTimeValue(timeValue);
}

function handleChangeEndTimeValue(timeValue: string) {
setEndTimeValue(timeValue);

console.log(typeof timeValue);
}

function handleOpenModal() {
setOpenModal(true);
}

function handleCloseModal() {
setOpenModal(false);
}

function checkTimeValue(time: string) {
const hour = time.split(" ")[1];
const realTime = time.split(" ")[0];

return hour === "AM" ? "์˜ค์ „ " + realTime : "์˜คํ›„ " + realTime;
}

function handleInputStudentName(e: React.ChangeEvent<HTMLInputElement>) {
setStudentName(e.target.value);
}

function handleSaveTimes() {
handleCloseModal();
const newTimeData = startTimeValue.split(" ")[0] + "~" + endTimeValue.split(" ")[0];
const originTimeDatas = classData
.map(({ student, times }) => student === studentName && times)
.filter((time) => time !== false)[0];

setClassData(
classData.map((data) =>
data.student === studentName
? {
...data,
times: [...originTimeDatas, { dates: moment(value).format("YYYY-MM-DD"), time: newTimeData }],
}
: data,
),
);
}

return (
<JisooCalendarContainer>
{openModal && (
<Modal>
<ModalTitleWrapper>
<ModalTitle>{moment(value).format("YYYY-MM-DD")}</ModalTitle>
<XButton onClick={handleCloseModal}>X</XButton>
</ModalTitleWrapper>
<TimePickerWrapper>
<li>
<p>์‹œ์ž‘</p>
<TimePicker
onChange={handleChangeStartTimeValue}
value={startTimeValue}
cancelButtonText="์ทจ์†Œ"
saveButtonText="ํ™•์ธ"
use12Hours
/>
<RealTimeBox>{checkTimeValue(startTimeValue)}</RealTimeBox>
</li>
<li>
<p>์ข…๋ฃŒ</p>
<TimePicker
onChange={handleChangeEndTimeValue}
value={endTimeValue}
cancelButtonText="์ทจ์†Œ"
saveButtonText="ํ™•์ธ"
use12Hours
/>
<RealTimeBox>{checkTimeValue(endTimeValue)}</RealTimeBox>
</li>
</TimePickerWrapper>
<StudentNameInput type="text" placeholder="ํ•™์ƒ์ด๋ฆ„" onChange={handleInputStudentName} />
<TimeResultButtom type="button" onClick={handleSaveTimes}>
์ €์žฅ
</TimeResultButtom>
</Modal>
)}
<JisooCalendarWrapper onClick={handleOpenModal}>
<Calendar
onChange={onChange}
// useState๋กœ ํฌ์ปค์Šค ๋ณ€๊ฒฝ ์‹œ ํ˜„์žฌ ๋‚ ์งœ ๋ฐ›์•„์˜ค๊ธฐ
formatDay={(locale, date) => moment(date).format("DD")} // ๋‚ '์ผ' ์ œ์™ธํ•˜๊ณ  ์ˆซ์ž๋งŒ ๋ณด์ด๋„๋ก ์„ค์ •
value={value}
minDetail="month"
maxDetail="month"
showNeighboringMonth={false}
tileContent={({ date, view }) => {
let html: Element[] = [];
{
classData.map(({ id, student, times, color }: calendarDatatTypes) => {
times.map(
({ dates, time }) =>
dates === moment(date).format("YYYY-MM-DD") &&
html.push(
<Box key={id} $color={color}>
<p>{student}</p>
<p>{time}</p>
</Box>,
),
);
});
}

return <>{html}</>;
}}
/>
</JisooCalendarWrapper>
</JisooCalendarContainer>
);
}

const ModalTitle = styled.h1`
${({ theme }) => theme.fonts.caption_large};
`;

const XButton = styled.p`
${({ theme }) => theme.fonts.caption_large};

cursor: pointer;
`;

const JisooCalendarContainer = styled.div`
display: flex;
justify-content: center;
align-items: center;
`;

const Modal = styled.aside`
display: flex;
flex-direction: column;
align-items: space-between;
/* justify-content: space-between; */

position: absolute;

width: 50rem;
height: 50rem;
padding: 3rem;

border: 1px solid ${({ theme }) => theme.colors.black};
border-radius: 5px;
background-color: ${({ theme }) => theme.colors.gray1};
`;

const Box = styled.button<{ $color: string }>`
display: flex;

padding: 1rem;
margin: 1rem !important;

border-radius: 5px;

background-color: ${({ $color }) => $color};
`;

const JisooCalendarWrapper = styled.div`
display: flex;
justify-content: center;
margin: 2rem 0;

.react-calendar__navigation button:disabled {
//์ œ๋ชฉ
color: ${({ theme }) => theme.colors.main};
background-color: ${({ theme }) => theme.colors.white};
${({ theme }) => theme.fonts.body1};
}

.react-calendar {
border: none;
width: 100%;
height: 100%;
${({ theme }) => theme.fonts.body1};
}
.react-calendar__month-view {
// ๋‚ ์งœ
abbr {
color: ${({ theme }) => theme.colors.black};
}
}
.react-calendar__month-view__weekdays {
// ์š”์ผ
abbr {
${({ theme }) => theme.fonts.body1};
text-decoration: none;
}
}
.react-calendar__tile {
//ํƒ€์ผ ํ•œ ์นธ
text-align: center;
min-height: 10rem;
padding: 1rem;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: center;
border: 0.5px solid black;
}
/*hover, focus, ์„ ํƒ๋์„ ์‹œ */
.react-calendar__tile:enabled:hover,
.react-calendar__tile:enabled:focus,
.react-calendar__tile--active {
background-color: ${({ theme }) => theme.colors.gray1};
outline: none;
cursor: pointer;
}
/* ์˜ค๋Š˜ ๋‚ ์งœ */
.react-calendar__tile--now:enabled:hover,
.react-calendar__tile--now:enabled:focus,
.react-calendar__tile--now {
background: ${({ theme }) => theme.colors.sub1};
border-radius: 10px;
}
/* 1๋…„ ์•ž๋’ค ๋ฒ„ํŠผ */
.react-calendar__navigation__prev2-button,
.react-calendar__navigation__next2-button {
display: none;
}
`;

const TimePickerWrapper = styled.ul`
display: flex;
justify-content: space-between;
align-items: center;

width: 30rem;
margin-top: 3rem;
`;

const ModalTitleWrapper = styled.header`
display: flex;
justify-content: space-between;
`;

const RealTimeBox = styled.div`
position: absolute;

${({ theme }) => theme.fonts.body1};

z-index: 0;
`;

const TimeResultButtom = styled.button`
padding: 1rem;
margin-top: 35rem;

border: 1px solid black;

cursor: pointer;
`;

const StudentNameInput = styled.input`
margin-top: -4.5rem;

border: 1px solid black;
`;
Empty file removed src/core/.keep
Empty file.
Loading