Yuki Takei 5 лет назад
Родитель
Сommit
71ed21117f
1 измененных файлов с 1 добавлено и 12 удалено
  1. 1 12
      src/client/js/components/Navbar/SearchTop.jsx

+ 1 - 12
src/client/js/components/Navbar/SearchTop.jsx

@@ -16,7 +16,6 @@ class SearchTop extends React.Component {
     this.state = {
       text: '',
       isScopeChildren: false,
-      isCollapsed: true,
     };
 
     this.onInputChange = this.onInputChange.bind(this);
@@ -25,16 +24,6 @@ class SearchTop extends React.Component {
     this.search = this.search.bind(this);
   }
 
-  componentWillMount() {
-    this.initBreakpointEvents();
-  }
-
-  initBreakpointEvents() {
-    this.props.appContainer.addBreakpointListener('md', (mql) => {
-      this.setState({ isCollapsed: !mql.matches });
-    }, true);
-  }
-
   onInputChange(text) {
     this.setState({ text });
   }
@@ -62,7 +51,7 @@ class SearchTop extends React.Component {
   }
 
   Root = ({ children }) => {
-    const { isCollapsed } = this.state;
+    const { isDeviceSmallThanMd: isCollapsed } = this.props.appContainer.state;
 
     return isCollapsed
       ? (