mirror of
https://github.com/Steffo99/bluelib.git
synced 2024-12-22 11:34:21 +00:00
Add useBluelibInBody
hook
This commit is contained in:
parent
49e5fcd3bb
commit
241731cad6
2 changed files with 17 additions and 0 deletions
16
src/hooks/useBluelibInBody.tsx
Normal file
16
src/hooks/useBluelibInBody.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { useRef, useEffect } from "react"
|
||||
import { useBluelib } from "./useBluelib"
|
||||
|
||||
export function useBluelibInBody(theme) {
|
||||
const ref = useRef<HTMLBodyElement | null>(null)
|
||||
useEffect(
|
||||
() => {
|
||||
ref.current = document.body as HTMLBodyElement
|
||||
},
|
||||
[ref]
|
||||
)
|
||||
|
||||
useBluelib(ref, {
|
||||
theme,
|
||||
})
|
||||
}
|
|
@ -60,3 +60,4 @@ export {Bluelib as default} from "./components/Bluelib"
|
|||
export {usePromise} from "./hooks/usePromise"
|
||||
export {useFormState} from "./hooks/useFormState"
|
||||
export {useBluelib} from "./hooks/useBluelib"
|
||||
export {useBluelibInBody} from "./hooks/useBluelibInBody"
|
||||
|
|
Loading…
Reference in a new issue