mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-01 16:00:29 +02:00
feat(v2): Provide typing to most of the theme-classic components (#3348)
* feat(v2): Provide typing to most of the theme-classic components * Expose type to the end users and dogfood it in v2 website
This commit is contained in:
parent
658dac7d42
commit
bd9b6618c1
31 changed files with 440 additions and 125 deletions
|
@ -9,13 +9,14 @@ import {useState, useCallback, useEffect} from 'react';
|
|||
import {useLocation} from '@docusaurus/router';
|
||||
import useLocationHash from '@theme/hooks/useLocationHash';
|
||||
import useScrollPosition from '@theme/hooks/useScrollPosition';
|
||||
import type {useHideableNavbarReturns} from '@theme/hooks/useHideableNavbar';
|
||||
|
||||
const useHideableNavbar = (hideOnScroll: boolean) => {
|
||||
const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
|
||||
const [isNavbarVisible, setIsNavbarVisible] = useState(true);
|
||||
const [isFocusedAnchor, setIsFocusedAnchor] = useState(false);
|
||||
const [lastScrollTop, setLastScrollTop] = useState(0);
|
||||
const [navbarHeight, setNavbarHeight] = useState(0);
|
||||
const navbarRef = useCallback((node) => {
|
||||
const navbarRef = useCallback((node: HTMLElement | null) => {
|
||||
if (node !== null) {
|
||||
setNavbarHeight(node.getBoundingClientRect().height);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue