mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-10 14:52:29 +02:00
refactor(v2): mobile dropdown navbar: expand when subitem become active (#5168)
This commit is contained in:
parent
007e901354
commit
818fb3956b
3 changed files with 63 additions and 5 deletions
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
||||
import {useLocation} from '@docusaurus/router';
|
||||
|
||||
// Get the pathname of current route, without the optional site baseUrl
|
||||
// - /docs/myDoc => /docs/myDoc
|
||||
// - /baseUrl/docs/myDoc => /docs/myDoc
|
||||
export function useLocalPathname(): string {
|
||||
const {
|
||||
siteConfig: {baseUrl},
|
||||
} = useDocusaurusContext();
|
||||
const {pathname} = useLocation();
|
||||
return pathname.replace(baseUrl, '/');
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue