-
Notifications
You must be signed in to change notification settings - Fork 10
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
[2주차] 권혜인 미션 제출합니다. #3
base: master
Are you sure you want to change the base?
Changes from all commits
ff01d1b
ce017e9
420fa58
f3a3678
eff2193
b5032fb
ca7fff7
01a514a
ad8d6b9
7e30b2e
a634729
153af81
3f63a01
c14a448
d33b832
6cb8a80
38b433c
1a0e43c
0a4d525
6ccbbcd
ecf1408
30f1855
0c1f75e
8353ab6
f44e4fb
a17251a
40d6bdf
bf7e51c
61979a9
7ce6cc0
407d1ea
9734e9f
af8d597
6e7d640
6a0121a
548de8b
b40b090
23ab57d
e5f877a
276f135
fbb20c0
6b5aa58
6d71eb7
39efac1
250f744
d3466d7
8c6dd0e
8c35cea
8d5ce61
79cfae7
55a1dd2
83ac4ac
8292b8a
ad272c9
99ba10b
5a71e66
b454c4b
3efed7c
e6e371c
c399530
f522306
b8869fe
bd7a646
1052ae2
9d5dfc7
528577a
cb4488f
d5af965
9ea397c
6b19970
894211b
8a7309c
ad13ee3
f76189b
2f33529
d919842
7b442f6
d127647
05f91cd
f4954a1
fbb758b
97750e7
6cab823
dbb5f69
f12e4ca
076ab1b
e6e669f
c39a90c
1d1a25f
9b217dd
63d861d
5478c2d
40dc19d
7ebc8f2
8496d3a
3a02be7
9c4628a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true, node: true }, | ||
parser: "@typescript-eslint/parser", | ||
plugins: ["@typescript-eslint", "prettier"], | ||
extends: [ | ||
"eslint:recommended", | ||
"eslint-config-prettier", | ||
"airbnb", | ||
"plugin:import/errors", | ||
"plugin:import/warnings", | ||
"plugin:prettier/recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"prettier/@typescript-eslint", | ||
], | ||
ignorePatterns: ["dist", ".eslintrc.cjs"], | ||
rules: { | ||
"linebreak-style": 0, | ||
"import/prefer-default-export": 0, | ||
"prettier/prettier": 0, | ||
"import/extensions": 0, | ||
"import/no-unresolved": 0, | ||
"import/no-extraneous-dependencies": 0, // 테스트 또는 개발환경을 구성하는 파일에서는 devDependency 사용을 허용 | ||
"react/prop-types": "off", | ||
"react/jsx-filename-extension": [2, { extensions: [".js", ".jsx", ".ts", ".tsx"] }], | ||
"jsx-a11y/no-noninteractive-element-interactions": 0, | ||
"eol-last": ["error", "always"], // line의 가장 마지막 줄에는 개행 넣기" | ||
"simple-import-sort/imports": "error", // import 정렬 | ||
"no-multi-spaces": "error", // 스페이스 여러개 금지 | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"semi": true, | ||
"tabWidth": 2, | ||
"printWidth": 120, | ||
"trailingComma": "all", | ||
"bracketSameLine": true, | ||
"endOfLine": "auto" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"extends": ["stylelint-config-standard", "stylelint-config-clean-order"], | ||
"customSyntax": "postcss-styled-syntax" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# React + Vite | ||
|
||
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules. | ||
|
||
Currently, two official plugins are available: | ||
|
||
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh | ||
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import js from '@eslint/js' | ||
import globals from 'globals' | ||
import react from 'eslint-plugin-react' | ||
import reactHooks from 'eslint-plugin-react-hooks' | ||
import reactRefresh from 'eslint-plugin-react-refresh' | ||
|
||
export default [ | ||
{ ignores: ['dist'] }, | ||
{ | ||
files: ['**/*.{js,jsx}'], | ||
languageOptions: { | ||
ecmaVersion: 2020, | ||
globals: globals.browser, | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
ecmaFeatures: { jsx: true }, | ||
sourceType: 'module', | ||
}, | ||
}, | ||
settings: { react: { version: '18.3' } }, | ||
plugins: { | ||
react, | ||
'react-hooks': reactHooks, | ||
'react-refresh': reactRefresh, | ||
}, | ||
rules: { | ||
...js.configs.recommended.rules, | ||
...react.configs.recommended.rules, | ||
...react.configs['jsx-runtime'].rules, | ||
...reactHooks.configs.recommended.rules, | ||
'react/jsx-no-target-blank': 'off', | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
Comment on lines
+32
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 저도 추가로, 지금처럼 상수들을 export할 때 jsx 파일이 아니라 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 네! 감사합니다 😄 |
||
}, | ||
}, | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!doctype html> | ||
<html lang="ko"> | ||
<head> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>WEB TODO</title> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.jsx"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 추가로 Vite를 이용해서 프로젝트를 잘 세팅해주신 것 같아요!!👍👍 그런데 혹시 따로 Vite를 사용하신 이유가 있을까요? 또, 프로젝트 안에 따로 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 일단 vite 를 사용한 이유는, 그리구 원래 과제를 할 때 저만의 폴더를 만들고 시작하는게 맘이 편하더라구요,,ㅎㅎ |
||
"name": "week2-ceos", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"lint": "eslint .", | ||
"preview": "vite preview", | ||
"lint:css": "stylelint './src/**/*.{ts,tsx,js,jsx}'", | ||
"lint:css:fix": "stylelint './src/**/*.{ts,tsx,js,jsx}' --fix" | ||
}, | ||
"dependencies": { | ||
"date-fns": "^3.6.0", | ||
"path": "^0.12.7", | ||
"prettier": "^3.3.3", | ||
"react": "^18.3.1", | ||
"react-calendar": "^5.0.0", | ||
"react-dom": "^18.3.1", | ||
"styled-components": "^6.1.13", | ||
"styled-reset": "^4.5.2", | ||
"url": "^0.11.4", | ||
"zustand": "^5.0.0-rc.2" | ||
}, | ||
"devDependencies": { | ||
"@eslint/js": "^9.9.0", | ||
"@types/react": "^18.3.3", | ||
"@types/react-dom": "^18.3.0", | ||
"@vitejs/plugin-react": "^4.3.1", | ||
"eslint": "^9.10.0", | ||
"eslint-plugin-react": "^7.35.0", | ||
"eslint-plugin-react-hooks": "^5.1.0-rc.0", | ||
"eslint-plugin-react-refresh": "^0.4.9", | ||
"globals": "^15.9.0", | ||
"postcss-styled-syntax": "^0.6.4", | ||
"prop-types": "^15.8.1", | ||
"stylelint": "^16.9.0", | ||
"stylelint-config-clean-order": "^6.1.0", | ||
"stylelint-config-standard": "^36.0.1", | ||
"vite": "^5.4.1" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { ThemeProvider } from "styled-components"; | ||
import theme from "./styles/theme"; | ||
import { GlobalStyle } from "./styles/globalStyle"; | ||
import MainPage from "./pages/MainPage"; | ||
|
||
function App() { | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<MainPage /> | ||
<GlobalStyle /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. globla style을 잘 지정해주신 점 너무 좋아요👍👍 |
||
</ThemeProvider> | ||
); | ||
} | ||
|
||
export default App; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 스타일을 유동적으로 바꿀 수 있게 설정한 것이 디자인 구조를 구성하는 데 있어 더 편리할 것 같습니다. 다양한 방법 배워갑니다! |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* eslint-disable react/prop-types */ | ||
import styled from "styled-components"; | ||
import { rowFlex } from "@styles/commonStyle"; | ||
import { format, isToday } from "date-fns"; | ||
|
||
export default function DayItem({ currentDay, handleClickDay }) { | ||
const isTodayBoolean = isToday(currentDay); | ||
const formattedDay = format(currentDay, "dd"); | ||
|
||
return ( | ||
<DayWrapper onClick={handleClickDay} $isTodayBoolean={isTodayBoolean}> | ||
{formattedDay} | ||
</DayWrapper> | ||
); | ||
} | ||
|
||
const DayWrapper = styled.span` | ||
${rowFlex} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
width: 2rem; | ||
height: 2rem; | ||
|
||
color: ${({ $isTodayBoolean, theme }) => { | ||
return $isTodayBoolean && theme.colors.white; | ||
}}; | ||
|
||
background-color: ${({ $isTodayBoolean, theme }) => { | ||
return $isTodayBoolean && theme.colors.main_blue; | ||
}}; | ||
border-radius: 10px; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import styled from "styled-components"; | ||
import { rowFlex } from "@styles/commonStyle"; | ||
|
||
const newDate = new Date(); | ||
const todayWeekDay = newDate.getDay(); | ||
|
||
//요일 부분 | ||
export default function DayofWeek() { | ||
const DAY_OF_WEEK = ["일", "월", "화", "수", "목", "금", "토"]; | ||
|
||
const weeksList = DAY_OF_WEEK.map((week, index) => ( | ||
<DayWrapper $week={index} key={week}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요일에 따라서 색상을 다르게 넣어주신 부분이 좋네요! 개인적으로는 |
||
{week} | ||
</DayWrapper> | ||
)); | ||
return <WeekWrapper>{weeksList}</WeekWrapper>; | ||
} | ||
|
||
const WeekWrapper = styled.section` | ||
${rowFlex} | ||
justify-content: space-between; | ||
`; | ||
|
||
const DayWrapper = styled.span` | ||
color: ${({ $week, theme }) => { | ||
if ($week === 0) { | ||
return theme.colors.sunday_red; | ||
} else if ($week === todayWeekDay) { | ||
return theme.colors.black; | ||
} else { | ||
return theme.colors.gray1; | ||
} | ||
}}; | ||
|
||
${({ theme, $week }) => ($week === todayWeekDay ? theme.fonts.Body1 : theme.fonts.Body2)}; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-disable react/prop-types */ | ||
import { addDays, format } from "date-fns"; | ||
import styled from "styled-components"; | ||
import { rowFlex } from "@styles/commonStyle"; | ||
import DayItem from "./DayItem"; | ||
import { ko } from "date-fns/locale"; | ||
|
||
//날짜들 부분 | ||
export default function Days(props) { | ||
const { weekStart, setClickedDay } = props; | ||
let days = []; | ||
|
||
// 현재 주의 날짜들을 생성 | ||
for (let i = 0; i < 7; i++) { | ||
const currentDay = addDays(weekStart, i); | ||
|
||
function handleClickDay() { | ||
const formattedClickedDate = format(currentDay, "MM월 dd일 EEEE", { locale: ko }); | ||
setClickedDay(formattedClickedDate); | ||
} | ||
|
||
days.push(<DayItem handleClickDay={handleClickDay} key={currentDay} currentDay={currentDay} />); | ||
} | ||
return ( | ||
<> | ||
<WeekWrapper>{[...days]}</WeekWrapper> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 궁금한 점이 있는데, 여기에서 직접 |
||
</> | ||
); | ||
} | ||
|
||
const WeekWrapper = styled.div` | ||
${rowFlex} | ||
justify-content: space-between; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* eslint-disable react/prop-types */ | ||
import styled from "styled-components"; | ||
import { rowFlex } from "@styles/commonStyle"; | ||
|
||
export default function Header(props) { | ||
const { headerDay, increaseWeek, decreaseWeek } = props; | ||
|
||
return ( | ||
<HeaderWrapper> | ||
<button onClick={decreaseWeek}>⬅️</button> | ||
{headerDay} | ||
<button onClick={increaseWeek}>➡️</button> | ||
</HeaderWrapper> | ||
); | ||
} | ||
|
||
const HeaderWrapper = styled.header` | ||
${rowFlex} | ||
padding: 5rem; | ||
${({ theme }) => theme.fonts.Headline1}; | ||
color: ${({ theme }) => theme.colors.black}; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-disable react/prop-types */ | ||
import styled from "styled-components"; | ||
import { rowFlex } from "@styles/commonStyle"; | ||
|
||
export default function ColorsBox(props) { | ||
const { color, onClick, boxColor } = props; | ||
|
||
return ( | ||
<Box onClick={onClick} $boxColor={color}> | ||
{boxColor === color && "🤍"} | ||
</Box> | ||
); | ||
} | ||
|
||
const Box = styled.button` | ||
${rowFlex} | ||
width: 5rem; | ||
height: 4rem; | ||
background-color: ${({ $boxColor }) => $boxColor}; | ||
border-radius: 10px; | ||
`; |
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.
제가 보기에는 이 프로젝트에서
react/jsx-no-target-blank
규칙을 끌 필요는 없을 것 같은데, 원래 사용하시던 규칙들을 가져오신건가요?!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.
네네! 원래 사용하던 거 가져왔습니다!