Skip to content

Commit

Permalink
Merge pull request #69 from vtexdocs/style/header-consider-modal
Browse files Browse the repository at this point in the history
Style/header consider modal
  • Loading branch information
brunoamui authored Aug 29, 2022
2 parents 969ad71 + 17c534e commit 8488086
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"path": "./node_modules/cz-conventional-changelog"
},
"rapidoc": {
"version": "1.0.7-vtex"
"version": "1.0.7-vtex-6-g1ac290e"
}
},
"resolutions": {
Expand Down
10 changes: 9 additions & 1 deletion src/components/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,17 @@ const Header = () => {

const observer = new MutationObserver(() => {
modalOpen.current = !modalOpen.current
if (headerElement.current) {
if (modalOpen.current) {
const headerHeight = headerElement.current.children[0].clientHeight
headerElement.current.style.top = `-${headerHeight}px`
} else {
headerElement.current.style.top = '0'
}
}
})
observer.observe(body, {
attributeFilter: ['class'],
attributeFilter: ['style'],
})
}, [])

Expand Down

0 comments on commit 8488086

Please sign in to comment.