Skip to content

Commit

Permalink
feat: useHeaderTitle 훅 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
dlwl98 committed Oct 30, 2023
1 parent 0c57675 commit f253059
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/hooks/useHeaderTitle.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { useIntersectionObserver } from './useIntersectionObserver';

export const useHeaderTitle = <T extends HTMLElement>() => {
const [entryRef, entry] = useIntersectionObserver<T>({});
const showHeaderTitle = !entry?.isIntersecting;

return { entryRef, showHeaderTitle };
};

0 comments on commit f253059

Please sign in to comment.