Skip to content

Commit 3911a33

Browse files
committed
#96 The current Menu selection is not shown on the IE11 and Edge
1 parent f284bd4 commit 3911a33

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/components/ChosenArrow/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styles from './styles.module.scss'
55
const ChosenArrow = ({ show, x }) => (
66
<div
77
className={styles.chosenArrow}
8-
style={{ transform: `translateX(calc(${x}px - 50%))` }}
8+
style={{ transform: `translateX(${x}px)` }}
99
hidden={!show}
1010
>
1111
<svg width='40px' height='10px' viewBox='0 0 40 10'>

src/components/ChosenArrow/styles.module.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.chosenArrow {
44
position: absolute;
55
bottom: -1px;
6-
left: 0;
6+
left: -20px;
77
z-index: 1;
88
-webkit-transition: -webkit-transform 0.5s;
99
transition: transform 0.5s;

src/components/IconSelect/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import styles from './styles.module.scss'
55
const IconSelect = ({ show, x }) => (
66
<span
77
className={styles.iconSelect}
8-
style={{ transform: `translateX(calc(${x}px - 50%))` }}
8+
style={{ transform: `translateX(${x}px)` }}
99
hidden={!show}
1010
/>
1111
)

src/components/IconSelect/styles.module.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.iconSelect {
44
position: absolute;
55
bottom: -1px;
6-
left: 0;
6+
left: -7px;
77
width: 15px;
88
height: 3px;
99
border-radius: 1.5px;

src/components/TopNav/index.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ const TopNav = ({
113113
const rect = el.getBoundingClientRect()
114114
return {
115115
...menu,
116-
initialX: rect.x
116+
initialX: rect.x || rect.left
117117
}
118118
}))
119119
}, [cache.refs, cache.slide])
120120

121121
const getMenuCenter = useCallback(menuId => {
122122
const el = cache.refs[menuId]
123123
const rect = el.getBoundingClientRect()
124-
return rect.x + rect.width / 2
124+
return (rect.x || rect.left) + rect.width / 2
125125
}, [cache.refs])
126126

127127
const setChosenArrowPos = useCallback(menuId => {
@@ -263,7 +263,7 @@ const TopNav = ({
263263
cache.slide[menu.id] = false
264264
const el = cache.refs[menu.id]
265265
const rect = el.getBoundingClientRect()
266-
const relativeX = menu.initialX - rect.x
266+
const relativeX = menu.initialX - (rect.x || rect.left)
267267
el.style.transform = `translateX(${relativeX}px)`
268268
setTimeout(() => {
269269
el.style.transition = 'transform 250ms ease-out'
@@ -344,7 +344,7 @@ const TopNav = ({
344344
let found = { m1: null, m2: null, m3: null }
345345

346346
// If haven't a path just return
347-
if(!path_) return found
347+
if (!path_) return found
348348

349349
menuWithId_.forEach(level1 => {
350350
if (level1.href && path_.indexOf(level1.href) > -1) found = { m1: level1.id, m2: null }
@@ -357,14 +357,14 @@ const TopNav = ({
357357
} else {
358358
found = { m1: level1.id, m2: level2.id, m3: level3.id }
359359
}
360-
if(!activeLevel3Id && level3.collapsed) setforceHideLevel3(true)
360+
if (!activeLevel3Id && level3.collapsed) setforceHideLevel3(true)
361361
}
362362
})
363363
})
364364
level1.secondaryMenu && level1.secondaryMenu.forEach(level3 => {
365365
if (level3.href) {
366366
// Check if path have parameters
367-
const href = level3.href.indexOf("?") > -1 ? level3.href.split("?")[0] : level3.href;
367+
const href = level3.href.indexOf('?') > -1 ? level3.href.split('?')[0] : level3.href
368368
if (path_.indexOf(href) > -1) found = { m1: level1.id, m3: level3.id }
369369
}
370370
})
@@ -390,13 +390,13 @@ const TopNav = ({
390390
forceExpand = true
391391
forceM2 = getMenuIdsFromPath(menuWithId, '/challenges').m2
392392
}
393-
} else if (path.indexOf('/my-dashboard') > -1 || path.indexOf('/members/'+profileHandle) > -1) {
393+
} else if (path.indexOf('/my-dashboard') > -1 || path.indexOf('/members/' + profileHandle) > -1) {
394394
// If My Dashboard and My Profile page
395395
setShowLevel3(true)
396396
} else if (path.indexOf('/community/learn') > -1 || path.indexOf('/thrive/tracks') > -1) {
397397
// Show 3rd level menu to Community [ Overview - How It Works ]
398-
forceM2 = getMenuIdsFromPath(menuWithId, '/community').m2;
399-
} else if(!m2) {
398+
forceM2 = getMenuIdsFromPath(menuWithId, '/community').m2
399+
} else if (!m2) {
400400
setShowLevel3(false)
401401
setforceHideLevel3(true)
402402
}

0 commit comments

Comments
 (0)