Skip to content

Conversation

minsgy
Copy link
Collaborator

@minsgy minsgy commented Sep 6, 2021

Colors

  • 뭔가 rgb 값을 뽑아서 랜덤 대입을 하는 줄 알았는데 사이트를 확인해보니 일정한 규칙으로 돌아가더군용!
  • Color 명이 계속해서 같은 규칙으로 대입됨을 확인하고 App에서 컬러 리스트를 상수 처리하여 사용했습니다.
  • 작지만.. 복습하듯 컴포넌트를 분할해서 구성했습니다.

Copy link
Collaborator

@datalater datalater left a comment

Choose a reason for hiding this comment

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

수업에서 배운 것을 활용하려고 노력하신 게 잘 보였던 코드였습니다. 또 원본 프로젝트를 유심히 살펴보신 것도 인상깊었네요 ㅎㅎ

코드리뷰가 익숙치 않아서 실수한 점이 있을 수도 있으니 자유롭게 말씀해주세요😀

$main.className = "main-container";
$target.appendChild($main);

let ColorListIndex = 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

사소한 부분이지만 자바스크립트 변수 네이밍 컨벤션은 camelCase니까 colorListIndex로 하면 어떨까요?ㅎㅎ

Comment on lines +34 to +36
if (ColorListIndex > COLOR_LIST.length - 1) {
ColorListIndex = 0;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

고양이 사진 검색기에서도 나왔던 패턴이군요! 저는 랜덤 컬러를 랜덤으로 만드는 것으로 구현했는데 민석님은 원본 프로젝트를 꼼꼼히 살펴보시고 정해진 패턴대로 움직인다는 것을 파악하셨네요 👍👍👍

Comment on lines +1 to +2
import App from "./components/App.js";
const $app = document.querySelector("#App");
Copy link
Collaborator

Choose a reason for hiding this comment

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

eslint에서는 import 라인 뒤에 new line을 넣도록 권장하고 있는데 한번 참고하시면 좋을 것 같습니다ㅎㅎ

링크

Comment on lines +34 to +41
@keyframes colorChange {
from {
color: #000000;
}
to {
color: #ffffff;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

저는 setInterval로 구현했는데 역시 CSS잘알이셔서 애니메이션을 활용하셨군요!! 배워갑니다👍👍👍

Comment on lines +7 to +8
<link rel="stylesheet" href="./assets/reset.css" />
<link rel="stylesheet" href="./assets/index.css" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

전에 동영팀 스크럼때 reset.css 말씀해주셨던 것 같은데 이렇게 활용하는 거군요ㅎㅎ배워갑니다👍

const secondColor = randHexColorCode();
const nextBackgroundColor = `background: linear-gradient(to right, ${firstColor}, ${secondColor});`;
colorText.setState({ firstColor, secondColor });
$main.style = nextBackgroundColor;
Copy link
Collaborator

Choose a reason for hiding this comment

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

  1. $main의 스타일을 고치는 부분도 setState로 처리해볼 수 있을 것 같은데 어떻게 생각하시나요?
  2. $main의 스타일(style) 객체 전체를 nextBackgroundColor로 할당하는 것보다 style.background = linear-gradient(to right, ...)와 같이 해당하는 것만 바꾸는 게 안전할 것 같다는 생각이 듭니다.

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