File tree Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Expand file tree Collapse file tree 4 files changed +45
-1
lines changed Original file line number Diff line number Diff line change 16
16
"usePrefersColorScheme" : " usePrefersColorScheme" ,
17
17
"usePreventCopy" : " usePreventCopy" ,
18
18
"useScrollLock" : " useScrollLock" ,
19
+ "useScrollY" : " useScrollY" ,
19
20
"useSound" : " useSound" ,
20
21
"useTimer" : " useTimer" ,
21
22
"useToggle" : " useToggle" ,
Original file line number Diff line number Diff line change
1
+ # useScrollY
2
+
3
+ ## Introduce
4
+
5
+ ํ์ฌ ํ์ด์ง์ ์คํฌ๋กค ์์น๋ฅผ ์ ์ฅํ๊ณ ์ด๋ํ๋ ํจ์๋ฅผ ๋ฐํํ๋ ํ
์
๋๋ค.
6
+
7
+ ``` ts
8
+ interface UseScrollYReturns {
9
+ moveTrigger: () => void ;
10
+ }
11
+
12
+ const useScrollY = (): UseScrollYReturns
13
+ ` ` `
14
+
15
+ ### Returns
16
+
17
+ - ` moveTrigger ` : ์ ์ฅ๋ ์คํฌ๋กค ์์น๋ก ์ด๋ํ๋ ํจ์
18
+
19
+ ## Examples
20
+
21
+ ` ` ` tsx copy filename =" TestComponent.tsx"
22
+ import { useScrollY } from ' @frontend-opensource/use-react-hooks' ;
23
+
24
+ function TestComponent() {
25
+ const { moveTrigger } = useScrollY ();
26
+
27
+ useEffect (() => {
28
+ moveTrigger ();
29
+ }, []);
30
+
31
+ return (
32
+ <div >
33
+ <h1 >USE - REACT - HOOKS < / h1 >
34
+ < / div >
35
+ );
36
+ }
37
+ ```
Original file line number Diff line number Diff line change 12
12
"build" : " rm -rf node_modules/.tmp && tsc -b --verbose" ,
13
13
"lint" : " eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0" ,
14
14
"preview" : " vite preview" ,
15
- "prepare" : " husky" ,
15
+ "prepare" : " if [ -d .git ] && command -v husky >/dev/null 2>&1; then husky install; else echo 'Skipping husky install'; fi " ,
16
16
"lint-staged" : " lint-staged" ,
17
17
"test" : " jest" ,
18
18
"coverage" : " jest --coverage"
Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ import { debounce } from '@/utils';
3
3
import { useLocalStorage } from '@/hooks/useLocalStorage' ;
4
4
import { Fn } from './type' ;
5
5
6
+ /**
7
+ * ํ์ฌ ํ์ด์ง์ ์คํฌ๋กค ์์น๋ฅผ ์ ์ฅํ๊ณ ์ด๋ํ๋ ํจ์๋ฅผ ๋ฐํํ๋ ํ
8
+ *
9
+ * @returns
10
+ * - `moveTrigger`: ์ ์ฅ๋ ์คํฌ๋กค ์์น๋ก ์ด๋ํ๋ ํจ์
11
+ */
6
12
const useScrollY = ( ) : { moveTrigger : Fn } => {
7
13
const isClient = typeof window !== 'undefined' ;
8
14
You canโt perform that action at this time.
0 commit comments