This repository was archived by the owner on Nov 8, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +31
-24
lines changed Expand file tree Collapse file tree 6 files changed +31
-24
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ const inialPlatform = {
10
10
isIE : false ,
11
11
isEdge : false ,
12
12
isMacOS : false ,
13
+ isMobile : false ,
13
14
}
14
15
15
16
// see https://stackoverflow.com/questions/49328382/browser-detection-in-reactjs/49328524
@@ -44,6 +45,8 @@ const usePlatform = (/* { breakpoint } */) => {
44
45
const isMacOS = Global . navigator . appVersion . indexOf ( 'Mac' ) != - 1
45
46
/* eslint-enable */
46
47
48
+ const isMobile = Global . innerWidth <= 800 && window . innerHeight <= 600
49
+
47
50
setPlatform (
48
51
R . merge ( inialPlatform , {
49
52
isFirefox,
@@ -52,6 +55,7 @@ const usePlatform = (/* { breakpoint } */) => {
52
55
isEdge,
53
56
isChrome,
54
57
isMacOS,
58
+ isMobile,
55
59
} )
56
60
)
57
61
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import PinButton from './PinButton'
7
7
8
8
import {
9
9
Wrapper ,
10
+ InnerWrapper ,
10
11
HeaderFuncs ,
11
12
SiteLogoWrapper ,
12
13
ExploreWrapper ,
@@ -18,22 +19,24 @@ import {
18
19
19
20
const Header = ( { pin } ) => (
20
21
< 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 >
37
40
</ Wrapper >
38
41
)
39
42
Original file line number Diff line number Diff line change @@ -5,13 +5,15 @@ import { theme, cs } from '@utils'
5
5
import { Wrapper as IndexWrapper } from './index'
6
6
7
7
export const Wrapper = styled . div `
8
- ${ cs . flex ( ) } ;
9
8
margin-top: 14px;
10
9
margin-bottom: ${ ( { pin } ) => ( pin ? '0' : '20px' ) } ;
11
10
${ IndexWrapper } :hover & {
12
11
margin-bottom: 4px;
13
12
}
14
13
`
14
+ export const InnerWrapper = styled . div `
15
+ ${ cs . flex ( 'align-center' ) } ;
16
+ `
15
17
export const HeaderFuncs = styled . div `
16
18
${ cs . flexGrow ( ) } ;
17
19
`
Original file line number Diff line number Diff line change 1
1
import styled from 'styled-components'
2
2
3
3
export const Wrapper = styled . div `
4
- margin-top: 0px;
5
4
left: 0;
6
5
position: relative;
7
6
height: 100%;
Original file line number Diff line number Diff line change @@ -139,8 +139,8 @@ const GlobalStyle = createGlobalStyle`
139
139
color: ${ theme ( 'searchHighlight.doramonFg' ) } ;
140
140
}
141
141
142
- ${ ( { isMacOS } ) =>
143
- isMacOS ||
142
+ ${ ( { showCustomScrollbar } ) =>
143
+ showCustomScrollbar ||
144
144
css `
145
145
::-webkit-scrollbar {
146
146
background: transparent;
Original file line number Diff line number Diff line change @@ -17,9 +17,8 @@ import AntUIOverWrite from './AntUIOverWrite'
17
17
import GlobalStyle from './GlobalStyle'
18
18
19
19
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
23
22
24
23
return (
25
24
< ThemeProvider theme = { themeData } >
@@ -30,7 +29,7 @@ const ThemeContainer = ({ children, theme: { themeData } }) => {
30
29
< div > { children } </ div >
31
30
< CodeSyxHighlight />
32
31
< AntUIOverWrite />
33
- < GlobalStyle isMacOS = { isMacOS } />
32
+ < GlobalStyle showCustomScrollbar = { showCustomScrollbar } />
34
33
</ React . Fragment >
35
34
</ ThemeProvider >
36
35
)
You can’t perform that action at this time.
0 commit comments