-
Notifications
You must be signed in to change notification settings - Fork 15
[석수민_FrontEnd] 4주차 과제 제출합니다. #42
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
Open
sumin4747
wants to merge
5
commits into
BCSDLab-Edu:main
Choose a base branch
from
sumin4747:sumin04
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,41 @@ | ||
| body { | ||
| font-family: Arial, sans-serif; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 100vh; | ||
| background-color: #f4f4f4; | ||
| margin: 0; | ||
| } | ||
|
|
||
| .container { | ||
| text-align: center; | ||
| padding: 20px; | ||
| border-radius: 8px; | ||
| background-color: white; | ||
| box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | ||
| width: 300px; | ||
| } | ||
|
|
||
| input { | ||
| padding: 10px; | ||
| width: 250px; | ||
| margin-bottom: 20px; | ||
| border: 1px solid #ccc; | ||
| border-radius: 4px; | ||
| } | ||
|
|
||
| button { | ||
| padding: 10px 20px; | ||
| border: none; | ||
| background-color: blue; | ||
| color: white; | ||
| border-radius: 8px; | ||
|
|
||
| } | ||
|
|
||
|
|
||
| .result { | ||
| margin-top: 20px; | ||
| font-size: 18px; | ||
| } |
This file contains hidden or 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,18 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>국가 수도 검색</title> | ||
| <link rel="stylesheet" href="api.css"> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <h1>국가 수도 검색</h1> | ||
| <input type="text" id="countryName" placeholder="나라를 입력하세요"> | ||
| <button class="button">검색</button> | ||
| <div class="result" id="result"></div> | ||
| </div> | ||
| <script src="api.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or 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,50 @@ | ||
| const button = document.querySelector('.button'); | ||
|
|
||
| async function getCountryInfo() { | ||
|
|
||
|
|
||
| const usercountryName = document.querySelector('#countryName').value; | ||
| const result = document.getElementById('result'); | ||
|
|
||
| if (usercountryName == "") { | ||
| alert("나라 이름을 입력해주세요.") | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| const res = await fetch(`https://restcountries.com/v3.1/name/${usercountryName}`) | ||
| const countries = await res.json(); | ||
|
Comment on lines
+15
to
+16
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. 굳굳! 👍 |
||
|
|
||
| if(countries && countries[0]){ | ||
| const country = countries[0]; | ||
| const countryName = country.name.common; | ||
|
|
||
| let capital; | ||
| if(country.capital && country.capital.length >0){ | ||
| capital = country.capital[0]; | ||
|
|
||
| } | ||
| else { | ||
|
|
||
| capital = "수도 정보가 없습니다." | ||
| } | ||
|
|
||
| const flag = country.flags.svg; | ||
|
|
||
| result.innerHTML = ` | ||
|
|
||
| <div> | ||
| <P><strong>${usercountryName}</strong> 수도: <strong>${capital}</strong></P> | ||
| <img src="${flag}" alt="Flag of ${usercountryName}" width="150"></img> | ||
| </div> | ||
| ` | ||
| } | ||
|
|
||
| else{ | ||
| result.textContent = "찾을 수 없습니다." | ||
| } | ||
| } | ||
|
|
||
|
|
||
|
|
||
| button.addEventListener('click', getCountryInfo); | ||
This file contains hidden or 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,185 @@ | ||
| body{ | ||
| background-color: #f0f0f0; | ||
| display: flex; | ||
| justify-content: center; | ||
|
|
||
| } | ||
|
|
||
| .container{ | ||
|
|
||
| width: 500px; | ||
| height: 520px; | ||
| border-radius: 10px; | ||
| background-color: white; | ||
|
|
||
| } | ||
|
|
||
| header{ | ||
| flex-direction:column; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| width: 500px; | ||
| height: 100px; | ||
| background-color: #4B89DC; | ||
| border-top-left-radius: 10px; | ||
| border-top-right-radius: 10px; | ||
| } | ||
|
|
||
| .title{ | ||
|
|
||
| font-family: Noto Sans KR; | ||
| font-size: 24px; | ||
| font-weight: 700; | ||
| color: white; | ||
|
|
||
| } | ||
|
|
||
|
|
||
| .subtitle{ | ||
|
|
||
| font-family: Noto Sans KR; | ||
| font-size: 16px; | ||
| font-weight: 400; | ||
| color: white; | ||
|
|
||
|
|
||
| } | ||
|
|
||
| .mainbox{ | ||
|
|
||
| display: flex; | ||
| flex-direction:column; | ||
| justify-content: center; | ||
| align-items: center; | ||
| } | ||
| .create-number{ | ||
|
|
||
| width: 460px; | ||
| height: 150px; | ||
| margin-top: 20px; | ||
|
|
||
|
|
||
| } | ||
|
|
||
| .buylotto{ | ||
| width: 460px; | ||
| height: 200px; | ||
| margin-top: 23px; | ||
|
|
||
| } | ||
|
|
||
|
|
||
| .numtitle{ | ||
| font-family: Noto Sans KR; | ||
| font-weight: 700; | ||
| font-size: 18px; | ||
| height: 100%; | ||
| } | ||
|
|
||
| .numbox{ | ||
| width: 100%; | ||
| height: 45px; | ||
| display: flex; | ||
| justify-content: space-between; | ||
| margin-top: 23px; | ||
|
|
||
|
|
||
| } | ||
| .numbox span{ | ||
| width: 45px; | ||
| height: 45px; | ||
| border-radius: 50%; | ||
| color: white; | ||
|
|
||
| font-size: 20px; | ||
| font-weight: 700; | ||
| font-family: Noto Sans KR; | ||
| text-align: center; | ||
| line-height: 45px; | ||
|
|
||
| } | ||
|
|
||
| .num1{ | ||
| background-color: #FBC400; | ||
| } | ||
|
|
||
| .num2{ | ||
| background-color: #69C8F2; | ||
| } | ||
| .num3{ | ||
| background-color: #FF7272; | ||
| } | ||
| .num4{ | ||
| background-color: #AAAAAA; | ||
| } | ||
| .num5{ | ||
| background-color: #B0D840; | ||
| } | ||
| .num6{ | ||
| background-color: #FBC400; | ||
| } | ||
|
|
||
|
|
||
| button{ | ||
|
|
||
| width: 460px; | ||
| height: 40px; | ||
| background-color: #A0B3E0; | ||
| border-radius: 5px; | ||
|
|
||
| font-family: Noto Sans KR; | ||
| font-weight: 700; | ||
| font-size: 16px; | ||
| color: white; | ||
|
|
||
| border-width: 0px; | ||
|
|
||
| margin-top: 15px; | ||
|
|
||
|
|
||
| } | ||
|
|
||
|
|
||
| .buytitle{ | ||
|
|
||
| font-family: Noto Sans KR; | ||
| font-weight: 700; | ||
| font-size: 18px; | ||
| height: 100%; | ||
|
|
||
|
|
||
| } | ||
|
|
||
| form{ | ||
| margin-top: 26px; | ||
| } | ||
| label{ | ||
|
|
||
| font-family: Noto Sans KR; | ||
| font-weight: 400; | ||
| font-size: 16px; | ||
|
|
||
| } | ||
|
|
||
| input[type="number"]{ | ||
|
|
||
| border: 1px solid #DDDDDD; | ||
| width: 380px; | ||
| height: 37px; | ||
| border-radius: 4px; | ||
|
|
||
| } | ||
|
|
||
| p{ | ||
| font-family: Noto Sans KR; | ||
| font-weight: 400px; | ||
| font-size: 16px; | ||
|
|
||
| } | ||
|
|
||
| .buy-lotto button{ | ||
|
|
||
| background-color: #4B89DC; | ||
| } | ||
|
|
This file contains hidden or 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,50 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>로또 번호 생성기</title> | ||
| <link rel="stylesheet" href="lotto.css"> | ||
| <link rel="preconnect" href="https://fonts.googleapis.com"> | ||
| <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | ||
| <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR:[email protected]&display=swap" rel="stylesheet"> | ||
| </head> | ||
| <body> | ||
| <div class="container"> | ||
| <header> | ||
| <span class="title">로또 번호 생성기</span> | ||
| <span class="subtitle">행운의 번호를 생성해보세요!</span> | ||
| </header> | ||
|
|
||
|
|
||
| <div class="mainbox"> | ||
| <div class="create-number"> | ||
| <span class="numtitle">번호 생성</span> | ||
| <div class="numbox"> | ||
| <span class="num1">?</span> | ||
| <span class="num2">?</span> | ||
| <span class="num3">?</span> | ||
| <span class="num4">?</span> | ||
| <span class="num5">?</span> | ||
| <span class="num6">?</span> | ||
| </div> | ||
| <button>번호 생성하기</button> | ||
| </div> | ||
|
|
||
| <div class="buylotto"> | ||
|
|
||
| <span class="buytitle">로또 구매하기</span> | ||
| <form> | ||
| <label for="amount">구매 수량: </label> | ||
| <input type="number" id="amount"> | ||
| </form> | ||
|
|
||
| <p>총 금액: <span id="total">0</span>원 (1장당 1,000원)</p> | ||
|
|
||
| <button>구매하기</button> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <script src="lotto.js"></script> | ||
| </body> | ||
| </html> |
This file contains hidden or 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,12 @@ | ||
| function generateLottoNumbers(){ | ||
|
|
||
| const set = new Set(); | ||
| while (set.size < 6) { | ||
| set.add(Math.floor(Math.random() * 45)+1); | ||
| } | ||
| return Array.from(set).sort((a,b)=>a-b); | ||
|
|
||
|
|
||
| } | ||
|
|
||
| console.log(generateLottoNumbers()) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.