Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit ffc8266

Browse files
committed
chore: Merge branch 'fix/safari-jumpy' into dev
2 parents b866f40 + 0b23718 commit ffc8266

File tree

6 files changed

+31
-24
lines changed

6 files changed

+31
-24
lines changed

components/Hooks/usePlatform.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const inialPlatform = {
1010
isIE: false,
1111
isEdge: false,
1212
isMacOS: false,
13+
isMobile: false,
1314
}
1415

1516
// see https://stackoverflow.com/questions/49328382/browser-detection-in-reactjs/49328524
@@ -44,6 +45,8 @@ const usePlatform = (/* { breakpoint } */) => {
4445
const isMacOS = Global.navigator.appVersion.indexOf('Mac') != -1
4546
/* eslint-enable */
4647

48+
const isMobile = Global.innerWidth <= 800 && window.innerHeight <= 600
49+
4750
setPlatform(
4851
R.merge(inialPlatform, {
4952
isFirefox,
@@ -52,6 +55,7 @@ const usePlatform = (/* { breakpoint } */) => {
5255
isEdge,
5356
isChrome,
5457
isMacOS,
58+
isMobile,
5559
})
5660
)
5761

containers/Sidebar/Header.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import PinButton from './PinButton'
77

88
import {
99
Wrapper,
10+
InnerWrapper,
1011
HeaderFuncs,
1112
SiteLogoWrapper,
1213
ExploreWrapper,
@@ -18,22 +19,24 @@ import {
1819

1920
const Header = ({ pin }) => (
2021
<Wrapper pin={pin}>
21-
<HeaderFuncs>
22-
<SiteLogoWrapper pin={pin}>
23-
<SiteLogo src={`${ICON_BASE}/sidebar/everyday.svg`} />
24-
</SiteLogoWrapper>
25-
<ExploreWrapper pin={pin}>
26-
<a href="/communities" rel="noopener noreferrer" target="_blank">
27-
<Button size="small" type="primary" ghost>
28-
<ExploreContent>
29-
<ExploreIcon src={`${ICON_CMD}/telescope.svg`} />
30-
<ExploreText>Explore All</ExploreText>
31-
</ExploreContent>
32-
</Button>
33-
</a>
34-
</ExploreWrapper>
35-
</HeaderFuncs>
36-
<PinButton pin={pin} />
22+
<InnerWrapper>
23+
<HeaderFuncs>
24+
<SiteLogoWrapper pin={pin}>
25+
<SiteLogo src={`${ICON_BASE}/sidebar/everyday.svg`} />
26+
</SiteLogoWrapper>
27+
<ExploreWrapper pin={pin}>
28+
<a href="/communities" rel="noopener noreferrer" target="_blank">
29+
<Button size="small" type="primary" ghost>
30+
<ExploreContent>
31+
<ExploreIcon src={`${ICON_CMD}/telescope.svg`} />
32+
<ExploreText>Explore All</ExploreText>
33+
</ExploreContent>
34+
</Button>
35+
</a>
36+
</ExploreWrapper>
37+
</HeaderFuncs>
38+
<PinButton pin={pin} />
39+
</InnerWrapper>
3740
</Wrapper>
3841
)
3942

containers/Sidebar/styles/header.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import { theme, cs } from '@utils'
55
import { Wrapper as IndexWrapper } from './index'
66

77
export const Wrapper = styled.div`
8-
${cs.flex()};
98
margin-top: 14px;
109
margin-bottom: ${({ pin }) => (pin ? '0' : '20px')};
1110
${IndexWrapper}:hover & {
1211
margin-bottom: 4px;
1312
}
1413
`
14+
export const InnerWrapper = styled.div`
15+
${cs.flex('align-center')};
16+
`
1517
export const HeaderFuncs = styled.div`
1618
${cs.flexGrow()};
1719
`

containers/Sidebar/styles/menu_list.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import styled from 'styled-components'
22

33
export const Wrapper = styled.div`
4-
margin-top: 0px;
54
left: 0;
65
position: relative;
76
height: 100%;

containers/ThemeWrapper/GlobalStyle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ const GlobalStyle = createGlobalStyle`
139139
color: ${theme('searchHighlight.doramonFg')};
140140
}
141141
142-
${({ isMacOS }) =>
143-
isMacOS ||
142+
${({ showCustomScrollbar }) =>
143+
showCustomScrollbar ||
144144
css`
145145
::-webkit-scrollbar {
146146
background: transparent;

containers/ThemeWrapper/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ import AntUIOverWrite from './AntUIOverWrite'
1717
import GlobalStyle from './GlobalStyle'
1818

1919
const ThemeContainer = ({ children, theme: { themeData } }) => {
20-
const { isMacOS } = usePlatform()
21-
22-
console.log('isMacOS: ', isMacOS)
20+
const { isMacOS, isMobile } = usePlatform()
21+
const showCustomScrollbar = !isMacOS || !isMobile
2322

2423
return (
2524
<ThemeProvider theme={themeData}>
@@ -30,7 +29,7 @@ const ThemeContainer = ({ children, theme: { themeData } }) => {
3029
<div>{children}</div>
3130
<CodeSyxHighlight />
3231
<AntUIOverWrite />
33-
<GlobalStyle isMacOS={isMacOS} />
32+
<GlobalStyle showCustomScrollbar={showCustomScrollbar} />
3433
</React.Fragment>
3534
</ThemeProvider>
3635
)

0 commit comments

Comments
 (0)