mirror of https://github.com/buster-so/buster.git
update packages for view hook
This commit is contained in:
parent
d898e7ecc0
commit
9fea44cc60
|
@ -45,6 +45,7 @@
|
|||
"email-validator": "^2.0.4",
|
||||
"font-color-contrast": "^11.1.0",
|
||||
"framer-motion": "^12.5.0",
|
||||
"intersection-observer": "^0.12.2",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"js-cookie": "^3.0.5",
|
||||
|
@ -12939,6 +12940,12 @@
|
|||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/intersection-observer": {
|
||||
"version": "0.12.2",
|
||||
"resolved": "https://registry.npmjs.org/intersection-observer/-/intersection-observer-0.12.2.tgz",
|
||||
"integrity": "sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/is-alphabetical": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-2.0.1.tgz",
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
"email-validator": "^2.0.4",
|
||||
"font-color-contrast": "^11.1.0",
|
||||
"framer-motion": "^12.5.0",
|
||||
"intersection-observer": "^0.12.2",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"js-cookie": "^3.0.5",
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
'use client';
|
||||
|
||||
import 'intersection-observer';
|
||||
import { useState } from 'react';
|
||||
import type { BasicTarget } from '../lib/domTarget';
|
||||
|
@ -13,7 +15,7 @@ export interface Options {
|
|||
callback?: CallbackType;
|
||||
}
|
||||
|
||||
function useInViewport(target: BasicTarget | BasicTarget[], options?: Options) {
|
||||
export function useInViewport(target: BasicTarget | BasicTarget[], options?: Options) {
|
||||
const { callback, ...option } = options || {};
|
||||
|
||||
const [state, setState] = useState<boolean>();
|
||||
|
@ -54,5 +56,3 @@ function useInViewport(target: BasicTarget | BasicTarget[], options?: Options) {
|
|||
|
||||
return [state, ratio] as const;
|
||||
}
|
||||
|
||||
export default useInViewport;
|
||||
|
|
Loading…
Reference in New Issue