Skip to content

Commit 9eb2f07

Browse files
fix(website): scrolling stuff
1 parent 906f066 commit 9eb2f07

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

packages/overmind-website/backend/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,15 @@
6262
body {
6363
margin: 0;
6464
height: 100%;
65+
overflow: hidden;
6566
}
6667

6768
#overmind-app {
6869
height: 100%;
6970
background-color: #333;
7071
transition: background-color 0.2s ease-in, color 0.2s ease-in;
7172
overflow-y: scroll;
73+
-webkit-overflow-scrolling: touch;
7274
}
7375

7476
#overmind-loader {

packages/overmind-website/src/components/Api/elements.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const ListWrapper = styled.div`
1616
height: 100vh;
1717
right: calc(50% + 350px);
1818
overflow-y: scroll;
19+
-webkit-overflow-scrolling: touch;
1920
`
2021

2122
export const List = styled.ul`

packages/overmind-website/src/components/MobileTopBar/elements.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ export const Menu = styled.div`
3737
overflow-y: scroll;
3838
-webkit-overflow-scrolling: touch;
3939
border-right: 2px solid ${({ theme }) => theme.color.primary};
40+
padding: ${({ theme }) => theme.padding.small};
41+
padding-bottom: ${({ theme }) => theme.padding.large};
42+
box-sizing: border-box;
4043
`
4144

4245
export const Link = styled<{ selected?: boolean }, 'a'>('a')`

packages/overmind-website/src/components/MobileTopBar/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ class MobileTopBar extends React.Component<Props> {
1717
}
1818
openMenu = () => {
1919
this.menu.style.transform = 'translate3d(0, 0, 0)'
20+
const page: HTMLElement = document.querySelector('#overmind-app')
21+
page.style.overflowY = 'hidden'
2022
}
2123
closeMenu = () => {
2224
this.menu.style.transform = 'translate3d(-110vw, 0, 0)'
25+
const page: HTMLElement = document.querySelector('#overmind-app')
26+
page.style.overflowY = 'scroll'
2327
}
2428
render() {
2529
const { selectedTheme, currentPage, currentPath } = this.props

packages/overmind-website/src/components/Search/index.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ class Search extends React.Component<{}, State> {
4545
searchResult: [],
4646
showSearchResult: false,
4747
}
48+
isUnmounting: boolean
4849
componentDidMount() {
4950
document.addEventListener('click', () => {
5051
this.setState({
5152
showSearchResult: false,
5253
})
5354
})
5455
}
56+
componentWillUnmount() {
57+
this.isUnmounting = true
58+
}
5559
onChange = (event: React.ChangeEvent<HTMLInputElement>) => {
5660
const query = event.target.value
5761
this.setState({
@@ -67,6 +71,10 @@ class Search extends React.Component<{}, State> {
6771
this.search()
6872
}
6973
search = debounce(function() {
74+
if (this.isUnmounting) {
75+
return
76+
}
77+
7078
this.setState({
7179
isLoading: true,
7280
})
@@ -106,6 +114,10 @@ class Search extends React.Component<{}, State> {
106114
if (this.state.searchResult.length) {
107115
// Let closing click event go through first
108116
setTimeout(() => {
117+
if (this.isUnmounting) {
118+
return
119+
}
120+
109121
this.setState({
110122
showSearchResult: true,
111123
})

0 commit comments

Comments
 (0)