-
Notifications
You must be signed in to change notification settings - Fork 15
[추아현_FrontEnd] 3주차 과제 제출합니다. #31
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
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 235112a.
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.
늦은 시간까지 과제하시느랴 수고하셨습니다.
| }); | ||
|
|
||
|
|
||
| document.getElementById('count-input').addEventListener('input', () => { |
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.
const input = document.getElementById('count-input');
이미 상단에서 DOM 요소를 가져왔으니 또 가져올 필요는 없어 보여요
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.
document.getElementById('count-input').addEventListener('input', (e) => {
const count = parseInt(e.target.value) || 0;
totalPrice.textContent = `총 금액: ${count * 1000}원 (1장당 1,000원)`;
});
처럼 event 객체를 이용해서 사용할 수도 있어요 자주 사용되는 방식이니 공부해두시면 좋을 것 같아요
| const winning = displayWinningNumbers(); | ||
|
|
||
| for (let i = 0; i < count; i++) { | ||
| const numbers = RandomNumber(); | ||
| const matchCount = checkMatches(numbers, winning); | ||
| const row = createLotto(numbers); | ||
|
|
||
| const resultText = document.createElement('p'); | ||
| resultText.className = 'result-badge'; | ||
| resultText.textContent = `결과: ${matchCount}개 일치` + (matchCount === 6 ? ' - 당첨!' : ''); |
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.
지금 구조에서는 구매하기 버튼이 이번주 당첨번호 생성, 내가 구매한 번호 생성을 모두 수행하는 것으로 보여요
기능 명세상으로는 번호 생성하기 버튼을 클릭시 이번주 당첨번호가 생성되고 당첨 여부를 검증하니 수정해보면 좋을 것 같아요
| height: 100vh; | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; |
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.
화면 배율에 따라 로또를 많이 구매했을때 잘리는 현상이 발생할 수 있을 것 같아요
| .ball-yellow { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| width: 45px; | ||
| height: 45px; | ||
| border-radius: 50%; | ||
| font-weight: bold; | ||
| margin: 5px; | ||
| font-size: 18px; | ||
| color: white; | ||
| background-color: #fbc400; | ||
| } |
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.
공의 색상을 지정하는 부분과 그외의 공통적인 부분을 분리해서 적용한다면 중복되는 코드를 줄일 수 있어요
| box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); | ||
| text-align: center; | ||
| box-sizing: border-box; | ||
| margin-top: 0; |
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.
부모 요소에서 margin을 이미 적용해주었기에 중복되는 css예요
| const MyNumber = document.createElement('p'); | ||
| MyNumber.textContent = "내가 구매한 번호:"; | ||
| winningArea.appendChild(MyNumber); | ||
| winningArea.style.display = 'block'; |
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.
지난주 pr에 답변 드렸습니다~ 확인해주세요
No description provided.