mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Add MenuBar component
This commit is contained in:
parent
d1de5ae94f
commit
8a7547b9cd
1
ui/app/components/menu-bar/index.js
Normal file
1
ui/app/components/menu-bar/index.js
Normal file
@ -0,0 +1 @@
|
||||
export { default } from './menu-bar.container'
|
23
ui/app/components/menu-bar/index.scss
Normal file
23
ui/app/components/menu-bar/index.scss
Normal file
@ -0,0 +1,23 @@
|
||||
.menu-bar {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
margin-bottom: 16px;
|
||||
padding: 5px;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
|
||||
&__sidebar-button {
|
||||
font-size: 1.25rem;
|
||||
cursor: pointer;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
&__open-in-browser {
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
52
ui/app/components/menu-bar/menu-bar.component.js
Normal file
52
ui/app/components/menu-bar/menu-bar.component.js
Normal file
@ -0,0 +1,52 @@
|
||||
import React, { PureComponent } from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import Tooltip from '../tooltip'
|
||||
import SelectedAccount from '../selected-account'
|
||||
|
||||
export default class MenuBar extends PureComponent {
|
||||
static contextTypes = {
|
||||
t: PropTypes.func,
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
hideSidebar: PropTypes.func,
|
||||
isMascara: PropTypes.bool,
|
||||
sidebarOpen: PropTypes.bool,
|
||||
showSidebar: PropTypes.func,
|
||||
}
|
||||
|
||||
render () {
|
||||
const { t } = this.context
|
||||
const { isMascara, sidebarOpen, hideSidebar, showSidebar } = this.props
|
||||
|
||||
return (
|
||||
<div className="menu-bar">
|
||||
<Tooltip
|
||||
title={t('menu')}
|
||||
position="bottom"
|
||||
>
|
||||
<div
|
||||
className="fa fa-bars menu-bar__sidebar-button"
|
||||
onClick={() => sidebarOpen ? hideSidebar() : showSidebar()}
|
||||
/>
|
||||
</Tooltip>
|
||||
<SelectedAccount />
|
||||
{
|
||||
!isMascara && (
|
||||
<Tooltip
|
||||
title={t('openInTab')}
|
||||
position="bottom"
|
||||
>
|
||||
<div
|
||||
className="menu-bar__open-in-browser"
|
||||
onClick={() => global.platform.openExtensionInBrowser()}
|
||||
>
|
||||
<img src="images/popout.svg" />
|
||||
</div>
|
||||
</Tooltip>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
21
ui/app/components/menu-bar/menu-bar.container.js
Normal file
21
ui/app/components/menu-bar/menu-bar.container.js
Normal file
@ -0,0 +1,21 @@
|
||||
import { connect } from 'react-redux'
|
||||
import MenuBar from './menu-bar.component'
|
||||
import { showSidebar, hideSidebar } from '../../actions'
|
||||
|
||||
const mapStateToProps = state => {
|
||||
const { appState: { sidebarOpen, isMascara } } = state
|
||||
|
||||
return {
|
||||
sidebarOpen,
|
||||
isMascara,
|
||||
}
|
||||
}
|
||||
|
||||
const mapDispatchToProps = dispatch => {
|
||||
return {
|
||||
showSidebar: () => dispatch(showSidebar()),
|
||||
hideSidebar: () => dispatch(hideSidebar()),
|
||||
}
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(MenuBar)
|
Loading…
Reference in New Issue
Block a user