-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: [LINKER-110] 프로필 헤더 수정 #52
Conversation
@@ -0,0 +1,27 @@ | |||
import { useEffect, useState } from 'react'; | |||
|
|||
const useIsScrolling = (y = 0) => { |
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.
hook이 하는 역할이 스크롤 위치가 인자로 받은 값을 넘었는지 여부를 나타내는것 같아서 useIsScorllOver
, useScrollBoundary
같은 네이밍은 어떨까요?
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.
useIsScrollOver
로 수정했습니다
const handleScroll = () => { | ||
if (y < window.scrollY) { | ||
setIsScrolling(true); | ||
|
||
return; | ||
} | ||
|
||
setIsScrolling(false); | ||
}; | ||
|
||
window.addEventListener('scroll', handleScroll); | ||
|
||
return () => { | ||
window.removeEventListener('scroll', handleScroll); | ||
}; |
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.
scroll이벤트시마다 리렌더링이 발생하며 성능상 저하가 발생할 수 있을것 같은데 실제로 scrollY가 인자값을 통과하는 시점에만 setIsScrolling을 호출하도록 개선해봐도 좋을것 같습니다!
현재 isScrolling에 대한 ref값만 하나 추가하면 구현 가능하지 않을까 싶네요
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.
useEffect dependency array로 인해서 scroll 이벤트마다 리렌더링이 발생하지 않습니닷
unmount 이후 인수값보다 낮아지지 않으면 scroll 이벤트가 발생하지 않는다는 테스트 코드 추가해두었어용
packages/lds/src/Icon/Icon.tsx
Outdated
return ( | ||
<Image | ||
src={`${bucket}/icons/${name}.svg`} | ||
alt={`${name} icon`} | ||
width={size} | ||
height={size} | ||
height={height ?? size} |
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.
height와 size의 차이가 무엇인가요?!
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.
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.
감사합니당! 이해완료했습니닷!
f3994a8
to
dcdc8ab
Compare
작업 내용
반영 화면
2024-02-08.6.06.42.mov
2024-02-08.6.07.00.mov
기타