1
1
import * as React from 'react' ;
2
- import { FormattedMessage , useFullSidebarData , useLocation } from 'dumi' ;
3
2
import { MenuOutlined } from '@ant-design/icons' ;
4
- import { createStyles , css } from 'antd-style' ;
5
3
import type { MenuProps } from 'antd' ;
6
4
import { Menu } from 'antd' ;
7
- import * as utils from '../../utils' ;
8
- import type { SharedProps } from './interface' ;
5
+ import { createStyles , css } from 'antd-style' ;
6
+ import { FormattedMessage , useFullSidebarData , useLocation } from 'dumi' ;
7
+
9
8
import useLocale from '../../../hooks/useLocale' ;
10
9
import Link from '../../common/Link' ;
10
+ import * as utils from '../../utils' ;
11
+ import type { SharedProps } from './interface' ;
11
12
12
13
// ============================= Theme =============================
13
14
const locales = {
@@ -65,7 +66,7 @@ const useStyle = createStyles(({ token }) => {
65
66
position : absolute;
66
67
inset : 0 ;
67
68
background-color : transparent;
68
- content : "" ;
69
+ content : '' ;
69
70
}
70
71
}
71
72
@@ -114,14 +115,8 @@ export interface NavigationProps extends SharedProps {
114
115
onDirectionChange : ( ) => void ;
115
116
}
116
117
117
- export default ( {
118
- isZhCN,
119
- isMobile,
120
- responsive,
121
- directionText,
122
- onLangChange,
123
- onDirectionChange,
124
- } : NavigationProps ) => {
118
+ const HeaderNavigation : React . FC < NavigationProps > = ( props ) => {
119
+ const { isZhCN, isMobile, responsive, directionText, onLangChange, onDirectionChange } = props ;
125
120
const { pathname, search } = useLocation ( ) ;
126
121
const [ locale ] = useLocale ( locales ) ;
127
122
@@ -132,11 +127,7 @@ export default ({
132
127
133
128
const menuMode = isMobile ? 'inline' : 'horizontal' ;
134
129
135
- const module = pathname
136
- . split ( '/' )
137
- . filter ( ( path ) => path )
138
- . slice ( 0 , - 1 )
139
- . join ( '/' ) ;
130
+ const module = pathname . split ( '/' ) . filter ( Boolean ) . slice ( 0 , - 1 ) . join ( '/' ) ;
140
131
let activeMenuItem = module || 'home' ;
141
132
if ( pathname . startsWith ( '/changelog' ) ) {
142
133
activeMenuItem = 'docs/react' ;
@@ -287,7 +278,8 @@ export default ({
287
278
className = { styles . nav }
288
279
disabledOverflow
289
280
items = { items }
290
- style = { { borderRight : 0 } }
291
281
/>
292
282
) ;
293
283
} ;
284
+
285
+ export default HeaderNavigation ;
0 commit comments