-
Notifications
You must be signed in to change notification settings - Fork 0
Subin min #6
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?
Subin min #6
Conversation
Hello-Worldismine
commented
Jul 30, 2025
- useWindowSize 구현
- useCountdown 구현
- useTextColor 구현
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 colors = ['red', 'blue', 'green', 'orange', 'purple']; | ||
| const nextColor = colors[Math.floor(Math.random() * colors.length)]; | ||
| setColor(nextColor); | ||
| }; |
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 colors = ['red', 'blue', 'green', 'orange', 'purple']; | ||
| const nextColor = colors[Math.floor(Math.random() * colors.length)]; | ||
| setColor(nextColor); | ||
| }; |
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 colors = ['red', 'blue', 'green', 'orange', 'purple']; | ||
| const nextColor = colors[Math.floor(Math.random() * colors.length)]; | ||
| setColor(nextColor); | ||
| }; |
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.
랜덤으로 색을 고르도록 잘 구현하신 것 같아요.!!
| import { useState } from 'react'; | ||
|
|
||
| export const useTextColor = () => { | ||
| // 여러분의 use{Something}을 만들어주세요! |
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.
커스텀 훅의 목적이 분명해서 보기 좋아요!
글자 색상을 바꾸는 로직이라는 게 useTextColor라는 이름만 봐도 바로 느껴져서, 함수명을 직관적으로 잘 지으신 것 같아용
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.
색상 배열의 개수에 맞게 Math.floor(Math.random() * colors.length) 라고 코드 잘 작성해주신 것 같아요!
| const changeColor = () => { | ||
| // 예시로 색상을 랜덤하게 바꾸거나, 정해진 목록에서 바꿀 수 있음 | ||
| const colors = ['red', 'blue', 'green', 'orange', 'purple']; | ||
| const nextColor = colors[Math.floor(Math.random() * colors.length)]; |
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.
목록에서의 선택과 랜덤 변경을 모두 가능하게 해 둔 점이 인상 깊어요! UI에서 랜덤 선택 버튼을 따로 만들어봐도 재밌을 것 같습니다
| const changeColor = () => { | ||
| // 예시로 색상을 랜덤하게 바꾸거나, 정해진 목록에서 바꿀 수 있음 | ||
| const colors = ['red', 'blue', 'green', 'orange', 'purple']; | ||
| const nextColor = colors[Math.floor(Math.random() * colors.length)]; |
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 [color, setColor] = useState('black'); | ||
|
|
||
| const changeColor = () => { | ||
| // 예시로 색상을 랜덤하게 바꾸거나, 정해진 목록에서 바꿀 수 있음 | ||
| const colors = ['red', 'blue', 'green', 'orange', 'purple']; | ||
| const nextColor = colors[Math.floor(Math.random() * colors.length)]; |
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.
changeColor 시 기존 색상과 같은 값이 다시 나올 수 있는데 while 루프나 필터링으로 개선 가능할 것 같습니다
|
|
||
| const changeColor = () => { | ||
| // 예시로 색상을 랜덤하게 바꾸거나, 정해진 목록에서 바꿀 수 있음 | ||
| const colors = ['red', 'blue', 'green', 'orange', 'purple']; |
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.
정해진 배열에서 색깔이 랜덤으로 뽑히게 한 점이 인상깊어요!