Skip to content

김안나 - 자판기 온보딩 프로젝트#7

Open
Kimanna wants to merge 25 commits into
mainfrom
kimanna
Open

김안나 - 자판기 온보딩 프로젝트#7
Kimanna wants to merge 25 commits into
mainfrom
kimanna

Conversation

@Kimanna
Copy link
Copy Markdown

@Kimanna Kimanna commented Nov 23, 2024

IC2_FE 온보딩 프로젝트 - 자판기

@Kimanna Kimanna added the WIP 아직 작업 중입니다 label Nov 23, 2024
@Kimanna Kimanna added Needs Review 리뷰받을 준비가 되면 추가해주세요 WIP 아직 작업 중입니다 and removed WIP 아직 작업 중입니다 Needs Review 리뷰받을 준비가 되면 추가해주세요 labels Nov 27, 2024
Comment thread css/main.css Outdated
/* 자판기 스타일 */
.vending-machine {
border: 1px solid #000;
padding: 20px !important;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

꼭 필요한 !important 였을까요? CSS에서 !important는 너무 높은 우선순위를 가지고 있어서 최대한 자제하는 게 좋습니다.

Comment thread counter.js Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 vite에서 기본으로 만들어 준 파일이 남은 거죠?

Comment thread index.html Outdated
<input class="input-amount" type="number" id="inputAmount" placeholder="금액 입력" min="1">
</div>
<div class="col s2 input-button">
<button class="btn action-button" onclick="insertAmount()">투입</button>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onclick 이벤트 핸들러를 js에서 추가하도록 해보시겠어요?
전역 함수에 의존하지 않고도 기능이 동작하도록 만들기 위해서입니다.

Comment thread js/main.js Outdated
let totalAmount = 0;


function init() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 부분은 async 함수로 만들어보세요. await과 함께 사용되면 로직이 훨씬 단순해질 수 있습니다.

Comment thread js/main.js Outdated
button.classList.add('btn', 'product');
button.setAttribute('data-price', product.price);
button.innerHTML = `${product.name}<br><span>${product.price.toLocaleString()}원</span>`;
button.onclick = () => purchaseProduct(button);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"이벤트 위임을 사용해보세요"라고 말씀드렸던 것 기억하시죠? :)

Comment thread js/main.js Outdated

const button = document.createElement('button');
button.classList.add('btn', 'product');
button.setAttribute('data-price', product.price);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

button.dataset을 사용하지 않은 이유가 있을까요? :)

Comment thread js/main.js Outdated
Comment on lines +16 to +20
const buttonWrapper = document.createElement('div');
buttonWrapper.classList.add('col', 's4');

const button = document.createElement('button');
button.classList.add('btn', 'product');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 한땀한땀 HTML 구조를 정의하는 것보다는 template 태그를 사용해보시면 어떨까요?

@Kimanna Kimanna added Needs Review 리뷰받을 준비가 되면 추가해주세요 and removed WIP 아직 작업 중입니다 labels Dec 7, 2024
@taggon taggon added Reviewed 리뷰를 마친 상태입니다 and removed Needs Review 리뷰받을 준비가 되면 추가해주세요 labels Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed 리뷰를 마친 상태입니다

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants