Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/ChosenArrow/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './styles.module.scss'
const ChosenArrow = ({ show, x }) => (
<div
className={styles.chosenArrow}
style={{ transform: `translateX(calc(${x}px - 50%))` }}
style={{ transform: `translateX(${x}px)` }}
hidden={!show}
>
<svg width='40px' height='10px' viewBox='0 0 40 10'>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ChosenArrow/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.chosenArrow {
position: absolute;
bottom: -1px;
left: 0;
left: -7px;
z-index: 1;
-webkit-transition: -webkit-transform 0.5s;
transition: transform 0.5s;
Expand Down
2 changes: 1 addition & 1 deletion src/components/IconSelect/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import styles from './styles.module.scss'
const IconSelect = ({ show, x }) => (
<span
className={styles.iconSelect}
style={{ transform: `translateX(calc(${x}px - 50%))` }}
style={{ transform: `translateX(${x}px)` }}
hidden={!show}
/>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/IconSelect/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.iconSelect {
position: absolute;
bottom: -1px;
left: 0;
left: -7px;
width: 15px;
height: 3px;
border-radius: 1.5px;
Expand Down
6 changes: 3 additions & 3 deletions src/components/TopNav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ const TopNav = ({
const rect = el.getBoundingClientRect()
return {
...menu,
initialX: rect.left
initialX: rect.x || rect.left
}
}))
}, [cache.refs, cache.slide])

const getMenuCenter = useCallback(menuId => {
const el = cache.refs[menuId]
const rect = el.getBoundingClientRect()
return rect.left + rect.width / 2
return (rect.x || rect.left) + rect.width / 2
}, [cache.refs])

const setChosenArrowPos = useCallback(menuId => {
Expand Down Expand Up @@ -268,7 +268,7 @@ const TopNav = ({
cache.slide[menu.id] = false
const el = cache.refs[menu.id]
const rect = el.getBoundingClientRect()
const relativeX = menu.initialX - rect.left
const relativeX = menu.initialX - (rect.x || rect.left)
el.style.transform = `translateX(${relativeX}px)`
setTimeout(() => {
el.style.transition = 'transform 250ms ease-out'
Expand Down