@@ -12,6 +12,7 @@ import {
12
12
useSiteData ,
13
13
} from 'dumi' ;
14
14
import { INavItem } from 'dumi/dist/client/theme-api/types' ;
15
+ import { motion } from 'framer-motion' ;
15
16
import { useCallback , useContext , useEffect , useRef } from 'react' ;
16
17
import useAdditionalThemeConfig from '../../hooks/useAdditionalThemeConfig' ;
17
18
import useLocaleValue from '../../hooks/useLocaleValue' ;
@@ -82,6 +83,9 @@ const useStyle = () => {
82
83
` ,
83
84
navItem : css `
84
85
position : relative;
86
+ display : flex;
87
+ align-items : center;
88
+ justify-content : center;
85
89
` ,
86
90
newPlayer : css `
87
91
width : 100px ;
@@ -91,6 +95,12 @@ const useStyle = () => {
91
95
left : 50% ;
92
96
transform : translateX (-50% );
93
97
z-index : 9 ;
98
+ pointer-events : none;
99
+ ` ,
100
+ rightIcon : css `
101
+ margin-left : 8px ;
102
+ width : 16px ;
103
+ height : 16px ;
94
104
` ,
95
105
popoverMenuNav : css `
96
106
${ antCls } -menu-item ,
@@ -184,6 +194,24 @@ export default function Navigation({ isMobile, responsive }: NavigationProps) {
184
194
{ navItem . isNew ? (
185
195
< div ref = { playerDom } css = { style . newPlayer } > </ div >
186
196
) : null }
197
+ { navItem . rightIcon && (
198
+ < motion . div
199
+ style = { { display : 'inline-block' } }
200
+ animate = { {
201
+ rotate : [ - 5 , 5 , - 5 , 5 , 0 ] , // 轻微旋转
202
+ x : [ - 2 , 2 , - 2 , 2 , 0 ] , // 轻微水平移动
203
+ y : [ - 1 , 1 , - 1 , 1 , 0 ] , // 轻微垂直移动
204
+ transition : {
205
+ duration : 1.0 , // 增加持续时间,使晃动更加平滑
206
+ repeat : Infinity , // 无限循环
207
+ ease : 'easeInOut' , // 使用平滑的缓动函数
208
+ repeatDelay : 3 ,
209
+ } ,
210
+ } }
211
+ >
212
+ < img css = { style . rightIcon } src = { navItem . rightIcon } alt = "" />
213
+ </ motion . div >
214
+ ) }
187
215
</ div >
188
216
) ,
189
217
key : isExternalLinks ( navItem . link ) ? navItem . link : linkKeyValue ,
0 commit comments