Skip to content

add, 아마존UI - 카드네비게이션#125

Merged
crongro merged 1 commit intocode-squad:baekCodefrom
77unny:cardui
Feb 13, 2020
Merged

add, 아마존UI - 카드네비게이션#125
crongro merged 1 commit intocode-squad:baekCodefrom
77unny:cardui

Conversation

@77unny
Copy link
Copy Markdown

@77unny 77unny commented Feb 12, 2020

https://baekcode.github.io/codesquad-FE/day2/index.html

정신 없이 하다보니 미션 step1~2를 같이 해버렸습니다.

궁금 사항 :

  • 좋은 디렉토리 구조
  • module (import/export)로 구현 하고 싶어서 구현 하려니 HTML 문서를 사용할때는 일반적인 module 방식으로 하면 안되고, script src='url' type='module' 현재처럼 구현했습니다. 이방법이 좋은 방법인건지?

미션 :

  • STEP 1 : UI 구현
  • STEP 2 : 애니메이션 구현

[스켈레톤 코드 :: 작업 진행]

  • mock 데이터를 사용 하여 레이아웃 구현 완료
  • HTML파일에 module 형태 구현 완료
  • 애니메이션 구현 완료
  • 슬라이더 속성 추가 ( 보여줄 갯수, 애니메이션 스피드 조절가능 / 추가적인 기능 고려)
  • style css 구현 중
  • 네비 영역 클릭시 이벤트 구현 중

@crongro
Copy link
Copy Markdown
Contributor

crongro commented Feb 13, 2020

  • module (import/export)로 구현 하고 싶어서 구현 하려니 HTML 문서를 사용할때는 일반적인 module 방식으로 하면 안되고, script src='url' type='module' 현재처럼 구현했습니다. 이방법이 좋은 방법인건지?

정상적인 es modules 방식이에요.

@crongro
Copy link
Copy Markdown
Contributor

crongro commented Feb 13, 2020

커밋로그는 제대로 좀 하셔야 할 듯

Copy link
Copy Markdown
Contributor

@crongro crongro left a comment

Choose a reason for hiding this comment

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

UI코드들이 역할도 명확하고, 간결해서 좋네요.
여기까지 승인합니다.

다름 PR을 보내주세요~

<link rel="stylesheet" href="./src/style/style.css" />
<script src="./src/js/index.js" type="module"></script>
</head>
<body>
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 이네요!

@@ -0,0 +1,47 @@
const DATA = {
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.

data구조를 잘 잡았네요.

const card = new MainUI(DATA);
document.querySelector('#card').innerHTML = card.render();

const slider = new Slider({
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.

변경이 될 소지가 있는 클래스명과 아이디를 넘겨주는 거 좋아요!

this.itemEl = document.querySelector(option.itemEl);
this.prevEl = document.querySelector(option.prevEl);
this.nextEl = document.querySelector(option.nextEl);
this.run();
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.

run보다는 init? 정도가 좀더 나을거 같음.

this.run();
}
initStyle() {
const CLONE_NUMBER = 2;
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.

이렇게 변수화 시킨거 좋죠.

onNextClick() {
this.nextEl.addEventListener('click', () => {
if (this.CURRUNT_INDEX === this.itemsEl.length + this.VIEW) return;
this.contentsEl.addEventListener('transitionend', () => {
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.

이렇게 중첩된 구조로 코드를 표현하니 보기 어렵네요.
보기좋게 개선을 해보시죠. 함수분리라던가..

}
onNavClick() {
const INIT_ADD_NUMBER = 1;
for (const iterator of this.navLiEl) {
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.

for of 와 for의 차이는 무엇일까요?

onNavIndex() {
console.log('NAV INDEX => ', this.CURRUNT_INDEX);
}
run() {
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.

run 이름은 별로지만, 아래 5개 호출을 모아둔건 좋네요.

constructor(properties) {
this.properties = properties;
}
render() {
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.

render라는 일관된 이름 사용이 좋음.

for (const list of iterator.list) {
itemList += `<li>${list}</li>`;
}
items += `
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.

template literal 사용이 좋네요.
html코드가 길어지더라도 여기에 표현하는게 좀더 나은거 같고요. 이녀석이 view역할이라서..
물론 이걸 분리해서 별도 파일에 모아두는 것도 가능하죠.

@crongro crongro merged commit b191983 into code-squad:baekCode Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants