diff options
Diffstat (limited to 'src/utils/hooks/use-code-blocks-theme.tsx')
| -rw-r--r-- | src/utils/hooks/use-code-blocks-theme.tsx | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/src/utils/hooks/use-code-blocks-theme.tsx b/src/utils/hooks/use-code-blocks-theme.tsx deleted file mode 100644 index beb7b29..0000000 --- a/src/utils/hooks/use-code-blocks-theme.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { usePrismTheme } from '@utils/providers/prism-theme'; -import { useRouter } from 'next/router'; -import { RefObject, useEffect, useState } from 'react'; -import useIsMounted from './use-is-mounted'; - -const useCodeBlocksTheme = (el: RefObject<HTMLDivElement>) => { - const [preElements, setPreElements] = useState<NodeListOf<HTMLPreElement>>(); - const isMounted = useIsMounted(el); - const { setCodeBlocks } = usePrismTheme(); - const { asPath } = useRouter(); - - useEffect(() => { - const result = document.querySelectorAll<HTMLPreElement>('pre'); - setPreElements(result); - }, [asPath]); - - useEffect(() => { - isMounted && preElements && setCodeBlocks(preElements); - }, [isMounted, preElements, setCodeBlocks]); -}; - -export default useCodeBlocksTheme; |
