|
@ -12,6 +12,7 @@ import './Navigation.less'; |
|
|
|
|
|
|
|
|
export interface NavigationProps extends SharedProps { |
|
|
export interface NavigationProps extends SharedProps { |
|
|
isMobile: boolean; |
|
|
isMobile: boolean; |
|
|
|
|
|
isRTL: boolean; |
|
|
pathname: string; |
|
|
pathname: string; |
|
|
responsive: null | 'narrow' | 'crowded'; |
|
|
responsive: null | 'narrow' | 'crowded'; |
|
|
location: { pathname: string }; |
|
|
location: { pathname: string }; |
|
@ -22,6 +23,7 @@ export interface NavigationProps extends SharedProps { |
|
|
|
|
|
|
|
|
export default ({ |
|
|
export default ({ |
|
|
isZhCN, |
|
|
isZhCN, |
|
|
|
|
|
isRTL, |
|
|
isMobile, |
|
|
isMobile, |
|
|
pathname, |
|
|
pathname, |
|
|
responsive, |
|
|
responsive, |
|
@ -32,10 +34,7 @@ export default ({ |
|
|
}: NavigationProps) => { |
|
|
}: NavigationProps) => { |
|
|
const menuMode = isMobile ? 'inline' : 'horizontal'; |
|
|
const menuMode = isMobile ? 'inline' : 'horizontal'; |
|
|
|
|
|
|
|
|
const module = pathname |
|
|
const module = pathname.split('/').slice(0, -1).join('/'); |
|
|
.split('/') |
|
|
|
|
|
.slice(0, -1) |
|
|
|
|
|
.join('/'); |
|
|
|
|
|
let activeMenuItem = module || 'home'; |
|
|
let activeMenuItem = module || 'home'; |
|
|
if (location.pathname === 'changelog' || location.pathname === 'changelog-cn') { |
|
|
if (location.pathname === 'changelog' || location.pathname === 'changelog-cn') { |
|
|
activeMenuItem = 'docs/react'; |
|
|
activeMenuItem = 'docs/react'; |
|
@ -56,7 +55,7 @@ export default ({ |
|
|
<Menu.Item key="switch-direction" onClick={onDirectionChange}> |
|
|
<Menu.Item key="switch-direction" onClick={onDirectionChange}> |
|
|
{directionText} |
|
|
{directionText} |
|
|
</Menu.Item>, |
|
|
</Menu.Item>, |
|
|
getEcosystemGroup({ isZhCN }), |
|
|
getEcosystemGroup({ isZhCN, isRTL }), |
|
|
]; |
|
|
]; |
|
|
|
|
|
|
|
|
if (isMobile) { |
|
|
if (isMobile) { |
|
|