-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 42b7621
Showing
13 changed files
with
2,422 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }, | ||
], | ||
}, | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "medal-tracker", | ||
"private": true, | ||
"version": "0.0.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite", | ||
"build": "vite build", | ||
"lint": "eslint .", | ||
"preview": "vite preview" | ||
}, | ||
"dependencies": { | ||
"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": "^4.3.3", | ||
"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" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
body { | ||
background: #f4f4f9; | ||
} | ||
|
||
.container { | ||
width: 1000px; | ||
margin: 40px auto; | ||
padding: 20px; | ||
box-shadow: rgba(0, 0, 0, 0.16) 0px 3px 6px; | ||
border-radius: 5px; | ||
background: #ffffff; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
.title { | ||
color: #00347e; | ||
font-weight: 800; | ||
} | ||
|
||
.input-container { | ||
display: flex; | ||
flex-direction: row; | ||
gap: 8px; | ||
align-items: end; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.input-box { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
} | ||
|
||
label { | ||
margin-bottom: 5px; | ||
font-weight: 700; | ||
} | ||
|
||
.buttons { | ||
display: flex; | ||
gap: 8px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import React, { useState } from "react"; | ||
import "./App.css"; | ||
|
||
const App = () => { | ||
const [result, setResult] = useState([]); | ||
|
||
const [country, setCountry] = useState(""); | ||
const [gold, setGold] = useState(0); | ||
const [silver, setSilver] = useState(0); | ||
const [bronze, setBronze] = useState(0); | ||
|
||
const onSubmitHandler = (e) => { | ||
e.preventDefault(); | ||
|
||
const newResult = { | ||
id: new Date().getTime(), | ||
country: country, | ||
gold: Number(gold), | ||
silver: Number(silver), | ||
bronze: Number(bronze), | ||
}; | ||
|
||
setResult([...result, newResult]); | ||
|
||
setCountry(""); | ||
setGold(0); | ||
setSilver(0); | ||
setBronze(0); | ||
}; | ||
console.log(result); | ||
return ( | ||
<div> | ||
<div className="container"> | ||
<h1 className="title">2024 파리 올림픽</h1> | ||
<form className="input-container" onSubmit={onSubmitHandler}> | ||
<div className="input-box"> | ||
<label>국가명</label> | ||
<input | ||
type="text" | ||
name="country" | ||
placeholder="국가 입력" | ||
value={country} | ||
onChange={(e) => { | ||
setCountry(e.target.value); | ||
}} | ||
/> | ||
</div> | ||
<div className="input-box"> | ||
<label>금메달</label> | ||
<input | ||
type="number" | ||
name="gold" | ||
value={gold} | ||
onChange={(e) => { | ||
setGold(e.target.value); | ||
}} | ||
/> | ||
</div> | ||
<div className="input-box"> | ||
<label>은메달</label> | ||
<input | ||
type="number" | ||
name="silver" | ||
value={silver} | ||
onChange={(e) => { | ||
setSilver(e.target.value); | ||
}} | ||
/> | ||
</div> | ||
<div className="input-box"> | ||
<label>동메달</label> | ||
<input | ||
type="number" | ||
name="bronze" | ||
value={bronze} | ||
onChange={(e) => { | ||
setBronze(e.target.value); | ||
}} | ||
/> | ||
</div> | ||
<div className="buttons"> | ||
<button type="submit">국가 추가</button> | ||
<button>업데이트</button> | ||
</div> | ||
</form> | ||
<div> | ||
<p>아직 추가된 국가가 없습니다. 메달을 추적하세요!</p> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { StrictMode } from 'react' | ||
import { createRoot } from 'react-dom/client' | ||
import './index.css' | ||
import App from './App.jsx' | ||
|
||
createRoot(document.getElementById('root')).render( | ||
<StrictMode> | ||
<App /> | ||
</StrictMode>, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vite' | ||
import react from '@vitejs/plugin-react' | ||
|
||
// https://vite.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
}) |
Oops, something went wrong.