-
Notifications
You must be signed in to change notification settings - Fork 9
[Project1~3/이경미] Colors, Hex-Colors-Gradient, Quote Generator #15
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: JSmini_goumi1009
Are you sure you want to change the base?
[Project1~3/이경미] Colors, Hex-Colors-Gradient, Quote Generator #15
Conversation
Colors/script.js
Outdated
|
||
button.addEventListener('click', e => { | ||
const containerElement = e.target.closest('.container') | ||
containerElement.style.backgroundColor = randomColor(colors) |
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.body.style.backgroundColor = randomColor(colors)
라고 쓸 수도 있었을 것 같은데 container라는 클래스를 가진 div를 따로 생성하고 closest를 통해 요소를 선택하신 이유가 있는지 궁금합니다!
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.
아 그러네요... 퍼블리셔하면서 생긴 습관 같아요. body에 직접 스타일을 주게 되면 후에 변경이나 추가 해야 하는 상황에서 난감한 일을 몇번 격었더니 body는 그냥 페이지가 그려지는 공간이라고 생각하고 그냥 두게 되더라고요.
하지만 지금 같은 상황에서는 그냥 body에 style 입히는 것도 좋았겠네요! 좋은 질문 감사합니다!
덕분에 생각없이 쓰는 코드에 대해 생각해보게 되었습니다! 😁👍
안녕하세요, 경미님. 코드리뷰를 맡은 규란입니다! 개인적으로 조금 아쉬웠던 지점은 버튼을 눌렀을 때 배경색으로 나올 수 있는 색상이 배열 안에 들어있는 색상으로 한정적이다 보니 RGB 코드나 Hex Color Code를 무작위로 뽑아주는 함수로 구현해보셨어도 좋았겠다 싶은 생각이 들었습니다..! 코드를 보다가 궁금했던 점은 해당 코드에 코멘트로 남겨두었습니다! |
@gyulhana 안녕하세요 규란님 엉망인 PR 리뷰해주셔서 정말 감사합니다. |
1. Colors
2. Hex-Colors-Gradient
3. Quote Generator