@@ -44,10 +44,6 @@ class Layout extends Component {
4444 isHome : false
4545 } ;
4646
47- state = {
48- isScroll : false
49- } ;
50-
5147 componentDidMount ( ) {
5248 const { sock, listenToJob } = this . props ;
5349
@@ -62,8 +58,6 @@ class Layout extends Component {
6258 ...resource
6359 } ) ;
6460 } ) ;
65-
66- window . onscroll = this . handleScroll ;
6761 }
6862
6963 componentWillUnmount ( ) {
@@ -72,17 +66,8 @@ class Layout extends Component {
7266 if ( sock && ! isEmpty ( sock . _events ) ) {
7367 sock . _events = { } ;
7468 }
75-
76- window . onscroll = null ;
7769 }
7870
79- handleScroll = async ( ) => {
80- const scrollTop = getScrollTop ( ) ;
81- scrollTop > 0
82- ? this . setState ( { isScroll : true } )
83- : this . setState ( { isScroll : false } ) ;
84- } ;
85-
8671 goBack = ( ) => {
8772 const { history } = this . props ;
8873 history . goBack ( ) ;
@@ -105,7 +90,6 @@ class Layout extends Component {
10590
10691 const { isNormal, isDev, isAdmin } = this . props . user ;
10792 const hasMenu = ( isDev || isAdmin ) && ! isHome ;
108- const { isScroll } = this . state ;
10993 const paths = [ '/dashboard' , '/profile' , '/ssh_keys' , '/dev/apps' ] ;
11094 const isCenterPage = Boolean ( pageTitle ) ; // detail page, only one level menu
11195 const hasSubNav = hasMenu && ! isCenterPage && ! paths . includes ( match . path ) ;
@@ -124,7 +108,7 @@ class Layout extends Component {
124108 { noNotification ? null : < Notification /> }
125109 { backBtn }
126110
127- { hasMenu && < SideNav isScroll = { isScroll } hasSubNav = { hasSubNav } /> }
111+ { hasMenu && < SideNav hasSubNav = { hasSubNav } /> }
128112 { isNormal
129113 && ! isHome && < TitleBanner title = { title } hasSearch = { hasSearch } /> }
130114
0 commit comments