This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Layout): add layout region inputs
- Loading branch information
Showing
5 changed files
with
92 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
### Layout examples: | ||
### Empty layout: | ||
|
||
```js | ||
<Layout | ||
className='hide-in-test' | ||
logo={ | ||
<h1 style={{color: 'white'}}>LOGO</h1> | ||
} | ||
/> | ||
<Layout className='hide-in-test' /> | ||
``` | ||
|
||
### Populated Layout: | ||
|
||
```js | ||
<LayoutExampleWithMenuItems className='hide-in-test' /> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
import './Layout.css' | ||
import { Icon } from 'semantic-ui-react' | ||
import cx from 'classnames' | ||
import iconDashboard from '../../../assets/icon_mainav_dash_selected.svg' | ||
import iconOperations from '../../../assets/icon_mainav_ops_selected.svg' | ||
import LeftNav from '../../LeftNav/LeftNav' | ||
import PropTypes from 'prop-types' | ||
import React, { PureComponent } from 'react' | ||
import TopNav from '../../TopNav/TopNav' | ||
|
||
export default class Layout extends PureComponent { | ||
render () { | ||
const { logo, ...rest } = this.props | ||
const { logo, navItems, admin, ...rest } = this.props | ||
return ( | ||
<div {...rest} className={cx(this.props.className, 'layout__container')}> | ||
<TopNav className='layout__header'> | ||
<TopNav.Content align='left'>{logo}</TopNav.Content> | ||
<TopNav.Content className='top-nav__dropdown-selector' align='right'> | ||
{'administrator '} | ||
<Icon name='chevron down' size='small' /> | ||
{admin} | ||
</TopNav.Content> | ||
</TopNav> | ||
<LeftNav className='layout__nav'> | ||
<LeftNav.MenuItem active image={iconDashboard} /> | ||
<LeftNav.MenuItem image={iconOperations} /> | ||
</LeftNav> | ||
<LeftNav className='layout__nav'>{navItems}</LeftNav> | ||
<div className='layout__content'>{this.props.children}</div> | ||
</div> | ||
) | ||
} | ||
} | ||
Layout.propTypes = { | ||
logo: PropTypes.element.isRequired | ||
logo: PropTypes.element.isRequired, | ||
navItems: PropTypes.arrayOf(PropTypes.element).isRequired, | ||
admin: PropTypes.element | ||
} | ||
|
||
Layout.LeftNav = LeftNav | ||
Layout.TopNav = TopNav |
63 changes: 63 additions & 0 deletions
63
src/components/unstable/Layout/LayoutExampleWithMenuItems.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import { Popup, Menu, Icon, Input, Label } from 'semantic-ui-react' | ||
import iconDashboard from '../../../assets/icon_mainav_dash_selected.svg' | ||
import iconOperations from '../../../assets/icon_mainav_ops_selected.svg' | ||
import Layout from './Layout' | ||
import React from 'react' | ||
|
||
const onClick = () => console.log('Layout:navItem:clicked!') | ||
export default class LayoutExampleWithMenuItems extends React.Component { | ||
render () { | ||
return ( | ||
<Layout | ||
className='hide-in-test' | ||
logo={<h1 style={{ color: 'white' }}>LOGO</h1>} | ||
navItems={[ | ||
<Layout.LeftNav.MenuItem | ||
key='1' | ||
active | ||
image={iconDashboard} | ||
onClick={onClick} | ||
/>, | ||
<Layout.LeftNav.MenuItem | ||
key='2' | ||
image={iconOperations} | ||
onClick={onClick} | ||
/> | ||
]} | ||
admin={ | ||
<Popup | ||
hoverable | ||
position='bottom right' | ||
style={{ padding: 0 }} | ||
trigger={ | ||
<span> | ||
{'administrator '} | ||
<Icon name='chevron down' size='small' /> | ||
</span> | ||
} | ||
> | ||
<Menu vertical> | ||
<Menu.Item name='inbox' active onClick={this.handleItemClick}> | ||
<Label color='teal'>1</Label> | ||
Inbox | ||
</Menu.Item> | ||
|
||
<Menu.Item name='spam' onClick={this.handleItemClick}> | ||
<Label>51</Label> | ||
Spam | ||
</Menu.Item> | ||
|
||
<Menu.Item name='updates' onClick={this.handleItemClick}> | ||
<Label>1</Label> | ||
Updates | ||
</Menu.Item> | ||
<Menu.Item> | ||
<Input icon='search' placeholder='Search mail...' /> | ||
</Menu.Item> | ||
</Menu> | ||
</Popup> | ||
} | ||
/> | ||
) | ||
} | ||
} |