From 4ed329c21ddaa6c67887304ee2d8845e4644c7e6 Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Mon, 22 Oct 2018 11:00:20 +0100 Subject: [PATCH] Responsive Layout --- embark-ui/src/components/Layout.css | 3 + embark-ui/src/components/Layout.js | 109 ++++++++++-------- .../components/{search.css => SearchBar.css} | 10 +- embark-ui/src/components/SearchBar.js | 29 +++-- 4 files changed, 86 insertions(+), 65 deletions(-) create mode 100644 embark-ui/src/components/Layout.css rename embark-ui/src/components/{search.css => SearchBar.css} (78%) diff --git a/embark-ui/src/components/Layout.css b/embark-ui/src/components/Layout.css new file mode 100644 index 000000000..87feec1c4 --- /dev/null +++ b/embark-ui/src/components/Layout.css @@ -0,0 +1,3 @@ +.sidebar-minimizer { + display: block !important; +} \ No newline at end of file diff --git a/embark-ui/src/components/Layout.js b/embark-ui/src/components/Layout.js index 15005f7c6..b1a74dc4a 100644 --- a/embark-ui/src/components/Layout.js +++ b/embark-ui/src/components/Layout.js @@ -7,6 +7,8 @@ import {explorerSearch} from "../actions"; import {LIGHT_THEME, DARK_THEME} from '../constants'; import FontAwesome from 'react-fontawesome'; +import "./Layout.css"; + import { AppFooter, AppHeader, @@ -106,62 +108,83 @@ class Layout extends React.Component { this.setState({searchLoading: true}); } - closeSearchError() { + dismissSearchError() { this.setState({searchError: false}); } renderNav() { - return (); + return ( + + + + + + + + {HEADER_NAV_ITEMS.map((item) => ( + + + {item.name} + + ))} + + + + ); } renderRightNav() { - return (); + return ( + + ); } renderSettings() { const {logout, toggleTheme, currentTheme} = this.props; - return ( - - - - - toggleTheme()}> - - {currentTheme === DARK_THEME ? LIGHT_THEME : DARK_THEME} Mode - - Logout - - ); + return ( + + + + + + toggleTheme()}> + + {currentTheme === DARK_THEME ? LIGHT_THEME : DARK_THEME} Mode + + Logout + + + ); } renderFooter() { - return ( + return ( + Embark  Documentation  |  Github - ); + + ); } render() { @@ -173,11 +196,9 @@ class Layout extends React.Component { return (
- - {this.renderNav()} {this.renderRightNav()} @@ -185,7 +206,7 @@ class Layout extends React.Component {
{sidebar && - + @@ -195,11 +216,9 @@ class Layout extends React.Component { }
- {searchResult.error && this.state.searchError && {searchResult.error} - this.closeSearchError(e)}> - - - } + this.dismissSearchError()}> + {searchResult.error} + {children} diff --git a/embark-ui/src/components/search.css b/embark-ui/src/components/SearchBar.css similarity index 78% rename from embark-ui/src/components/search.css rename to embark-ui/src/components/SearchBar.css index 9ca738e25..86372e94f 100644 --- a/embark-ui/src/components/search.css +++ b/embark-ui/src/components/SearchBar.css @@ -18,12 +18,6 @@ box-shadow: none; } -.search-loading { +.search-bar .search-loading { margin-top: 16px; -} - -.search-error-close { - position: absolute; - cursor: pointer; - right: 20px; -} +} \ No newline at end of file diff --git a/embark-ui/src/components/SearchBar.js b/embark-ui/src/components/SearchBar.js index 3072019af..7c47401b0 100644 --- a/embark-ui/src/components/SearchBar.js +++ b/embark-ui/src/components/SearchBar.js @@ -1,10 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; -import {Form, FormGroup, Input, Button} from 'reactstrap'; +import {Form, Input, Button} from 'reactstrap'; import FontAwesome from 'react-fontawesome'; import classNames from 'classnames'; -import './search.css'; +import './SearchBar.css'; class SearchBar extends React.Component { constructor(props) { @@ -34,15 +34,20 @@ class SearchBar extends React.Component { render() { return ( -
- - this.onChange(e)} - value={this.state.searchValue} onKeyPress={e => this.onKeyPress(e)}/> - - + + {!this.props.loading && + + this.onChange(e)} + value={this.state.searchValue} onKeyPress={e => this.onKeyPress(e)}/> + + + } + {this.props.loading && +

Searching...

+ }
); } @@ -50,7 +55,7 @@ class SearchBar extends React.Component { SearchBar.propTypes = { searchSubmit: PropTypes.func.isRequired, - hidden: PropTypes.bool + loading: PropTypes.bool }; export default SearchBar;