File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
demo/react-vite/src/shared/components/AppNav Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 3131}
3232.AppNav__underline {
3333 height : 4px ;
34- width : 88px ;
3534 // margin-left: @padding_width;
3635 box-sizing : border-box ;
3736 background : @theme ;
3837 transition : 0.5s ease ;
39- transition-property : width, transform;
38+ transition-property : transform;
39+ transform-origin : left ;
4040}
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { useSwipe } from '../../hooks/useSwipe'
55import { navList } from './navList'
66import styles from './AppNav.module.less'
77import { useOffsetToParent } from './useOffsetToParent'
8+ const NAV_UNDERLINE_WIDTH = 100 ;
89
910const AppNav : FC = memo ( ( props ) => {
1011 const navigate = useNavigate ( )
@@ -22,7 +23,6 @@ const AppNav: FC = memo((props) => {
2223 }
2324 }
2425 } )
25-
2626 return (
2727 < section className = { styles . AppNav } >
2828 < nav className = { styles . AppNav__box } >
@@ -45,8 +45,8 @@ const AppNav: FC = memo((props) => {
4545 < div
4646 className = { styles . AppNav__underline }
4747 style = { {
48- width : activeNavOffset . width + 'px' ,
49- transform : `translateX(${ activeNavOffset . left } px)`
48+ width : NAV_UNDERLINE_WIDTH + 'px' ,
49+ transform : `translateX(${ activeNavOffset . left } px) scaleX( ${ activeNavOffset . width / NAV_UNDERLINE_WIDTH } )` ,
5050 } }
5151 />
5252 </ section >
You can’t perform that action at this time.
0 commit comments