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

[3주차 기본/심화/공유 과제] 1 to 50 게임 #3

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5a38c79
chore: 2주차 실습 파일 커밋
ocahs9 Oct 15, 2024
671b432
init: 기본 세팅
ocahs9 Oct 15, 2024
9fe6a79
feat: 관리 페이지 HTML 구성
ocahs9 Oct 15, 2024
bc60899
feat: 회원 관리 페이지 css 적용 완료(스타일링 x, 아이콘 x)
ocahs9 Oct 15, 2024
9d693d1
feat: 모달 기본 구성 완료
ocahs9 Oct 16, 2024
894eb5c
feat: constant.js 파일 추가
ocahs9 Oct 16, 2024
cc79136
feat: 테이블 렌더링 함수 구현
ocahs9 Oct 16, 2024
8ec9ba9
feat: 전체 체크 기능 구현
ocahs9 Oct 16, 2024
cc6df8b
feat: 하나라도 체크 안되면 all-check 버튼 false
ocahs9 Oct 16, 2024
fb86562
fix: 체크 박스 하나의 변화 -> 전체 체크 버튼에도 반영하도록 구현
ocahs9 Oct 16, 2024
4bae363
매번 체크박스 기능을 할당할 수 있도록 함수화 + NodeList를 Array로 변환
ocahs9 Oct 16, 2024
593f13f
feat: modal on/off 기능 구현
ocahs9 Oct 16, 2024
82767a5
fix: 불필요한 script 삭제
ocahs9 Oct 17, 2024
947bef2
fix: 렌더링 함수 파라미터 받도록 수정
ocahs9 Oct 17, 2024
986fed7
feat: 초기화, 검색 버튼 구현
ocahs9 Oct 17, 2024
3783b24
feat: 필터링 아이템 모듈화, 필터 초기화 기능 이동(검색->초기화)
ocahs9 Oct 17, 2024
b54c8ba
style: 검색 필터 배치에 grid 사용
ocahs9 Oct 17, 2024
7c8f7b6
feat: 테이블 내 링크 이동 구현
ocahs9 Oct 17, 2024
6a6e78b
feat: 테이블 내 성별 한글화
ocahs9 Oct 17, 2024
ceafe3e
style: 헤더 정확히 3등분 되도록 스타일링
ocahs9 Oct 18, 2024
a553076
feat: 선택 삭제 구현
ocahs9 Oct 18, 2024
8df7e22
feat: 선택 삭제 구현
ocahs9 Oct 18, 2024
de2af1f
feat: 멤버 추가 기능 구현
ocahs9 Oct 18, 2024
afd6509
feat: 비어있는 Input이 있을 경우 추가 안되도록 구현
ocahs9 Oct 18, 2024
1e3d40f
feat: 모달 닫기 버튼 구현
ocahs9 Oct 18, 2024
2411c0b
style: 헤더 퍼블리싱 완성
ocahs9 Oct 18, 2024
c45b71b
fix: 기존 div로 구현해놓았던 table을 전부 table 요소로 변환
ocahs9 Oct 25, 2024
d0168be
feat: Header 퍼블리싱
ocahs9 Oct 31, 2024
8ffbced
feat: 헤더 기본 기능 구현
ocahs9 Oct 31, 2024
e990802
feat: 게임 기본 구조 구현
ocahs9 Oct 31, 2024
cc702ac
feat: 게임 구현 중
ocahs9 Nov 1, 2024
ab56435
feat: 시간 측정, 게임 진행 구현
ocahs9 Nov 1, 2024
2c61e50
fix: 배경색 안 돌아오던 문제, 이전에 클릭한 최근 숫자 포함되던 문제 해결 - timeout 제대로 이용
ocahs9 Nov 1, 2024
3ee9d86
feat: 랭킹 기능 구현
ocahs9 Nov 1, 2024
b8fa8a9
feat: 초기화 기능 구현
ocahs9 Nov 1, 2024
2b8364f
나머지 커밋들
ocahs9 Nov 1, 2024
2c1dd9f
feat: 랭킹 모드일 때 헤더 오른쪽 부분 안 뜨도록 구현
ocahs9 Nov 2, 2024
0a393cd
feat: createPortal 이용해서 모달 구현
ocahs9 Nov 2, 2024
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
3 changes: 3 additions & 0 deletions practice/week2_practice/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
25 changes: 25 additions & 0 deletions practice/week2_practice/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>2주차 세미나 실습</h1>
<input id="todo-input" type="text">
<button id="todo-button">추가</button>
<h3>목록</h3>
<ul id="todos">
<li class="todo-list">
하이
</li>
<li>
<button>하이</button>
</li>
</ul>

<!--module로 해줘야 import 사용 가능-->
<script defer type="module" src="todo.js"></script>
</body>
</html>
50 changes: 50 additions & 0 deletions practice/week2_practice/todo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//alert("메롱");
const todoBtn = document.getElementById("todo-button");
const ul = document.getElementById("todos");
const input = document.getElementById("todo-input");

const addTodo = () => {
const li = document.createElement("li");

const deleteButton = document.createElement('button');
deleteButton.textContent = '삭제';
deleteButton.classList.add('delete-btn');


//혹은 li.textContent로!
const span = document.createElement("span");
span.textContent = input.value.trim();
li.appendChild(span);


//li.innerText = input.value.trim();

if(span.innerText !== ""){
ul.appendChild(li);
input.value = '';
}
li.appendChild(deleteButton);


console.log(li);

// 삭제 버튼 클릭 시 해당 아이템 삭제
deleteButton.addEventListener('click', function() {
ul.removeChild(li);
});



}
todoBtn.addEventListener('click', addTodo);



//엔터 눌러도 생성되도록 구현
const pressEnter = (e) => {
console.log("키 눌림");
if(e.key === "Enter"){
addTodo();
}
}
input.addEventListener("keypress", pressEnter);
24 changes: 24 additions & 0 deletions practice/week3_practice/.gitignore
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?
14 changes: 14 additions & 0 deletions practice/week3_practice/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 100,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": false,
"quoteProps": "as-needed",
"trailingComma": "es5",
"bracketSpacing": true,
"arrowParens": "always",
"endOfLine": "auto",
"jsxBracketSameLine": false,
"orderedImports": true
}
Binary file added practice/week3_practice/.yarn/install-state.gz
Binary file not shown.
893 changes: 893 additions & 0 deletions practice/week3_practice/.yarn/releases/yarn-4.1.0.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions practice/week3_practice/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.1.0.cjs
8 changes: 8 additions & 0 deletions practice/week3_practice/README.md
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
38 changes: 38 additions & 0 deletions practice/week3_practice/eslint.config.js
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 },
],
},
},
]
13 changes: 13 additions & 0 deletions practice/week3_practice/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<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>Vite + React</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
32 changes: 32 additions & 0 deletions practice/week3_practice/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "week3_practice",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"emotion": "^11.0.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@eslint/js": "^9.13.0",
"@types/react": "^18.3.11",
"@types/react-dom": "^18.3.1",
"@vitejs/plugin-react-swc": "^3.5.0",
"eslint": "^9.13.0",
"eslint-plugin-react": "^7.37.1",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.13",
"globals": "^15.11.0",
"vite": "^5.4.9"
},
"packageManager": "yarn@4.1.0"
}
1 change: 1 addition & 0 deletions practice/week3_practice/public/vite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions practice/week3_practice/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { useState } from "react";
import { members } from "./constants/members";
import styled from "@emotion/styled";
import Card from "./Card";

function App() {
console.log(members);
const [count, setCount] = useState(0);

return (
<>
<h1>React Practice</h1>
<Grid>
{members.map((member) => (
<Card
key={`Card-${member.id}`}
id={member.id}
name={member.name}
englishName={member.englishName}
github={member.github}
gender={member.gender}
role={member.role}
firstWeekGroup={member.firstWeekGroup}
secondWeekGroup={member.secondWeekGroup}
></Card>
))}
</Grid>
</>
);
}

const Grid = styled.div`
display: grid;
grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(5, 1fr);
grid-gap: 10px;

width: 100vw;
height: 100vh;
`;

export default App;
50 changes: 50 additions & 0 deletions practice/week3_practice/src/Card.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import React, { useState } from "react";
import styled from "@emotion/styled";

const Card = ({ id, name, englishName, github, gender, role, firstWeekGroup, secondWeekGroup }) => {
const [count, setCount] = useState(0); //여기에 useState의 파라미터(인자)로 들어가는 숫자가 초기값인거야

//그럼 이제 화면 다시 돌아가볼게 버튼 눌러보면 숫자가 바뀌는지 안 바뀌는지!
//아까는 숫자가 안 바뀌었던 거 기억하지? ㅇㅋ
console.log(count);

const click = () => {
setCount(count + 1);
};

return (
<CardContainer>
<Item>{id}</Item>
<Item>{name}</Item>
<Item>{englishName}</Item>
<Item>{github}</Item>
<Item>{gender}</Item>
<Item>{role}</Item>
<Item>{firstWeekGroup}</Item>
<Item>{secondWeekGroup}</Item>
<LikeButton onClick={click}>{count}</LikeButton>
</CardContainer>
);
};

export default Card;

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

//grid 밑에서는 해당 셀에서의 크기임
width: 100%;
//height: 20vh;
border: 1px solid black;
`;

const Item = styled.div``;

const LikeButton = styled.button`
width: 30px;
height: 30px;
background-color: wheat;
`;
1 change: 1 addition & 0 deletions practice/week3_practice/src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading