1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-27 21:00:13 +01:00
metamask-extension/ui/app/components/menu-bar/menu-bar.component.js

64 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-07-30 19:42:09 +02:00
import React, { PureComponent } from 'react'
import PropTypes from 'prop-types'
import Tooltip from '../tooltip'
import SelectedAccount from '../selected-account'
2018-10-03 03:29:03 +02:00
import AccountDetailsDropdown from '../dropdowns/account-details-dropdown.js'
2018-07-30 19:42:09 +02:00
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,
}
2018-10-03 03:29:03 +02:00
state = { accountDetailsMenuOpen: false }
2018-07-30 19:42:09 +02:00
render () {
const { t } = this.context
const { isMascara, sidebarOpen, hideSidebar, showSidebar } = this.props
2018-10-03 03:29:03 +02:00
const { accountDetailsMenuOpen } = this.state
2018-07-30 19:42:09 +02:00
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
2018-10-03 03:29:03 +02:00
title={t('accountOptions')}
2018-07-30 19:42:09 +02:00
position="bottom"
>
<div
2018-10-03 03:29:03 +02:00
className="fa fa-ellipsis-h fa-lg menu-bar__open-in-browser"
onClick={() => this.setState({ accountDetailsMenuOpen: true })}
2018-07-30 19:42:09 +02:00
>
</div>
</Tooltip>
)
}
2018-10-03 03:29:03 +02:00
{
accountDetailsMenuOpen && (
<AccountDetailsDropdown
className="menu-bar__account-details-dropdown"
2018-10-03 03:29:03 +02:00
onClose={() => this.setState({ accountDetailsMenuOpen: false })}
/>
)
}
2018-07-30 19:42:09 +02:00
</div>
)
}
}