Skip to content
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: useFocus 구현 #28

Merged
merged 4 commits into from
Nov 21, 2024
Merged

feat: useFocus 구현 #28

merged 4 commits into from
Nov 21, 2024

Conversation

d0422
Copy link
Member

@d0422 d0422 commented Nov 21, 2024

  • useFocus 기능 추가
  • 테스트코드 작성
  • Storybook&Docs추가
2024-11-21.11.34.28.mov

useFocus

DOM Element가 화면에 노출되었을때, callback으로 전달된 함수를 실행합니다.

함수인자

onFocusCallback : 요소가 focus되었을때, 수행할 함수입니다.

threshold : 요소가 화면에 보일때의 기준을 결정합니다. 1이면 전체요소가 모두 화면에 들어왔을때 입니다.

rootMargin : 화면의 너비, 높이를 조정할 수 있습니다. "top right bottom left" 형태로 기재하며 반드시 단위를 명시해야합니다.

반환값

ref: focus될 DOM요소에 할당해줄 ref 객체입니다.

관련 이슈

#27

@d0422 d0422 self-assigned this Nov 21, 2024
@d0422 d0422 requested a review from HBSPS November 21, 2024 02:36
@d0422 d0422 added the feature label Nov 21, 2024
Copy link
Contributor

@HBSPS HBSPS left a comment

Choose a reason for hiding this comment

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

수고하셨습니다!

Comment on lines 5 to 6
threshold?: number,
rootMargin?: string,
Copy link
Contributor

Choose a reason for hiding this comment

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

threshold = 0.1과 같이 한다면 기본값임을 명확히 알 수 있고 밑에서는 조건이 빠져 읽기 쉬울 것 같아요

Copy link
Member Author

Choose a reason for hiding this comment

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

감사합니다
2027151 에서 반영완료했습니다!

@d0422 d0422 merged commit 6155fc6 into Rapiders:main Nov 21, 2024
1 check passed
@d0422 d0422 deleted the feature-useFocus branch November 21, 2024 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants