conflict in Layout

This commit is contained in:
Jonathan Rainville 2018-10-19 09:44:52 -04:00 committed by Pascal Precht
parent 203c4253d7
commit aa742e4a6e
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 73 additions and 53 deletions

View File

@ -63,10 +63,6 @@ const getSidebar = (location) => {
return currentItem && SIDEBAR_NAV_ITEMS[currentItem]; return currentItem && SIDEBAR_NAV_ITEMS[currentItem];
} }
function searchTheExplorer(_value) {
// TODO: search
}
class Layout extends React.Component { class Layout extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -105,18 +101,8 @@ class Layout extends React.Component {
this.setState({loading: true}); this.setState({loading: true});
} }
render() { renderNav() {
const {children, logout, location, toggleTheme, currentTheme, searchResult} = this.props; return (<Nav className="d-md-down-none" navbar>
return (<div className="app animated fadeIn">
<AppHeader fixed>
<AppSidebarToggler className="d-lg-none" display="md" mobile />
<AppNavbarBrand
full={{ src: logo, width: 50, height: 50, alt: 'Embark Logo' }}
minimized={{ src: logo, width: 30, height: 30, alt: 'Embark Logo' }}
/>
<AppSidebarToggler className="d-md-down-none" display="lg" />
<Nav className="d-md-down-none" navbar>
{sidebarNavItems.items.map((item) => { {sidebarNavItems.items.map((item) => {
return ( return (
<NavItem className="px-3" key={item.url}> <NavItem className="px-3" key={item.url}>
@ -127,13 +113,24 @@ class Layout extends React.Component {
</NavItem> </NavItem>
); );
})} })}
</Nav> </Nav>);
<Nav className="ml-auto" navbar> }
renderRightNav() {
const searchResult = this.props.searchResult;
return (<Nav className="ml-auto" navbar>
<SearchBar searchSubmit={searchValue => this.searchTheExplorer(searchValue)}/> <SearchBar searchSubmit={searchValue => this.searchTheExplorer(searchValue)}/>
{this.state.loading && <p>Searching...</p>} {this.state.loading && <p>Searching...</p>}
{searchResult.error && <Alert color="danger">{searchResult.error}</Alert>} {searchResult.error && <Alert color="danger">{searchResult.error}</Alert>}
<AppHeaderDropdown direction="down"> {this.renderSettings()}
</Nav>);
}
renderSettings() {
const {logout, toggleTheme, currentTheme} = this.props;
return (<AppHeaderDropdown direction="down">
<DropdownToggle nav> <DropdownToggle nav>
<i className="icon-settings" /> <i className="icon-settings" />
</DropdownToggle> </DropdownToggle>
@ -144,35 +141,58 @@ class Layout extends React.Component {
</DropdownItem> </DropdownItem>
<DropdownItem onClick={logout}><FontAwesome name="lock" /> Logout</DropdownItem> <DropdownItem onClick={logout}><FontAwesome name="lock" /> Logout</DropdownItem>
</DropdownMenu> </DropdownMenu>
</AppHeaderDropdown> </AppHeaderDropdown>);
</Nav> }
</AppHeader>
<div className="app-body"> renderSideBar() {
{sidebar && return (<AppSidebar fixed display="lg">
<AppSidebar fixed display="lg">
<AppSidebarHeader /> <AppSidebarHeader />
<AppSidebarForm /> <AppSidebarForm />
<AppSidebarNav navConfig={sidebarNavItems} location={location} /> <AppSidebarNav navConfig={sidebarNavItems} location={this.props.location} />
<AppSidebarFooter /> <AppSidebarFooter />
<AppSidebarMinimizer /> <AppSidebarMinimizer />
</AppSidebar> </AppSidebar>);
} }
<main className="main">
<Container fluid className="h-100" style={{marginTop: '24px'}}> renderFooter() {
{children} return (<AppFooter>
</Container>
</main>
<AppAside fixed>
</AppAside>
</div>
<AppFooter>
<span className="ml-auto"> <span className="ml-auto">
Embark&nbsp; Embark&nbsp;
<a href="https://embark.status.im" title="Documentation" rel="noopener noreferrer" target="_blank">Documentation</a> <a href="https://embark.status.im" title="Documentation" rel="noopener noreferrer" target="_blank">Documentation</a>
&nbsp;|&nbsp; &nbsp;|&nbsp;
<a href="https://github.com/embark-framework" title="Github" rel="noopener noreferrer" target="_blank">Github</a> <a href="https://github.com/embark-framework" title="Github" rel="noopener noreferrer" target="_blank">Github</a>
</span> </span>
</AppFooter> </AppFooter>);
}
render() {
const {children} = this.props;
return (<div className="app animated fadeIn">
<AppHeader fixed>
<AppSidebarToggler className="d-lg-none" display="md" mobile />
<AppNavbarBrand
full={{ src: logo, width: 50, height: 50, alt: 'Embark Logo' }}
minimized={{ src: logo, width: 30, height: 30, alt: 'Embark Logo' }}
/>
<AppSidebarToggler className="d-md-down-none" display="lg" />
{this.renderNav()}
{this.renderRightNav()}
</AppHeader>
<div className="app-body">
{this.renderSideBar()}
<main className="main">
<Container fluid className="h-100" style={{marginTop: '24px'}}>
{children}
</Container>
</main>
</div>
{this.renderFooter()}
</div>); </div>);
} }
} }