File tree 5 files changed +7
-7
lines changed
5 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import styles from './styles.module.scss'
5
5
const ChosenArrow = ( { show, x } ) => (
6
6
< div
7
7
className = { styles . chosenArrow }
8
- style = { { transform : `translateX(calc( ${ x } px - 50%) )` } }
8
+ style = { { transform : `translateX(${ x } px)` } }
9
9
hidden = { ! show }
10
10
>
11
11
< svg width = '40px' height = '10px' viewBox = '0 0 40 10' >
Original file line number Diff line number Diff line change 3
3
.chosenArrow {
4
4
position : absolute ;
5
5
bottom : -1px ;
6
- left : 0 ;
6
+ left : -20 px ;
7
7
z-index : 1 ;
8
8
-webkit-transition : -webkit-transform 0.5s ;
9
9
transition : transform 0.5s ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import styles from './styles.module.scss'
4
4
5
5
const IconSelect = ( { show, x, isResize } ) => {
6
6
let styleObj = {
7
- transform : `translateX(calc( ${ x } px - 50%) )`
7
+ transform : `translateX(${ x } px)`
8
8
9
9
}
10
10
// is window is on resize, stop animation
Original file line number Diff line number Diff line change 3
3
.iconSelect {
4
4
position : absolute ;
5
5
bottom : -1px ;
6
- left : 0 ;
6
+ left : -7 px ;
7
7
width : 15px ;
8
8
height : 3px ;
9
9
border-radius : 1.5px ;
Original file line number Diff line number Diff line change @@ -115,15 +115,15 @@ const TopNav = ({
115
115
const rect = el . getBoundingClientRect ( )
116
116
return {
117
117
...menu ,
118
- initialX : rect . left
118
+ initialX : rect . x || rect . left
119
119
}
120
120
} ) )
121
121
} , [ cache . refs , cache . slide ] )
122
122
123
123
const getMenuCenter = useCallback ( menuId => {
124
124
const el = cache . refs [ menuId ]
125
125
const rect = el . getBoundingClientRect ( )
126
- return rect . left + rect . width / 2
126
+ return ( rect . x || rect . left ) + rect . width / 2
127
127
} , [ cache . refs ] )
128
128
129
129
const setChosenArrowPos = useCallback ( menuId => {
@@ -269,7 +269,7 @@ const TopNav = ({
269
269
cache . slide [ menu . id ] = false
270
270
const el = cache . refs [ menu . id ]
271
271
const rect = el . getBoundingClientRect ( )
272
- const relativeX = menu . initialX - rect . left
272
+ const relativeX = menu . initialX - ( rect . x || rect . left )
273
273
el . style . transform = `translateX(${ relativeX } px)`
274
274
setTimeout ( ( ) => {
275
275
el . style . transition = 'transform 250ms ease-out'
You can’t perform that action at this time.
0 commit comments