Skip to content

Commit

Permalink
Refactor Menubar and AccountDetailsDropdown styles (#8278)
Browse files Browse the repository at this point in the history
  • Loading branch information
whymarrh authored Apr 2, 2020
1 parent ccf5d5d commit 4229892
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 55 deletions.
2 changes: 1 addition & 1 deletion test/e2e/metamask-responsive-ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe('MetaMask', function () {

describe('Show account information', function () {
it('show account details dropdown menu', async function () {
await driver.clickElement(By.css('div.menu-bar__open-in-browser'))
await driver.clickElement(By.css('button.menu-bar__account-options'))
const options = await driver.findElements(By.css('div.menu.account-details-dropdown div.menu__item'))
assert.equal(options.length, 4) // HD Wallet type does not have to show the Remove Account option
await driver.delay(regularDelayMs)
Expand Down
3 changes: 1 addition & 2 deletions ui/app/components/app/connected-status-indicator/index.scss
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.connected-status-indicator {
display:flex;
align-items: center;
position: absolute;
left: 22px;
place-self: center start;

&__green-circle, &__yellow-circle, &__grey-circle {
border-radius: 4px;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.account-details-dropdown {
position: absolute;
top: 120px;
right: 24px;
z-index: 1;
}
4 changes: 3 additions & 1 deletion ui/app/components/app/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,6 @@

@import '../ui/alert-circle-icon/index';

@import './connected-status-indicator/index'
@import './connected-status-indicator/index';

@import './dropdowns/account-details-dropdown/index';
45 changes: 14 additions & 31 deletions ui/app/components/app/menu-bar/index.scss
Original file line number Diff line number Diff line change
@@ -1,40 +1,23 @@
.menu-bar {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
flex: 0 0 auto;
margin-bottom: 16px;
padding: 0 22px;
display: grid;
grid-template-columns: 30% minmax(30%, 1fr) 30%;
column-gap: 5px;

margin-bottom: 24px;
padding: 0 24px;
border-bottom: 1px solid $Grey-100;
position: relative;

&__sidebar-button {
width: 20px;
height: 20px;
background-image: url(/images/icons/hamburger.svg);
background-repeat: no-repeat;
background-size: contain;
background-position: center;
cursor: pointer;
}
.menu-bar__account-options {
background: none;
font-size: inherit;
padding: 0 0 0 5px;

&__open-in-browser {
width: 20px;
height: 20px;
background-image: url(/images/icons/3dots.svg);
background-repeat: no-repeat;
background-size: contain;
background-position: center;
cursor: pointer;
display: flex;
justify-content: center;
position: absolute;
right: 16px;
transform: rotate(90deg);
position: relative; // to allow the dropdown to position itself absolutely
place-self: center end;
}

.selected-account {
flex: none;
grid-column: 2 / span 1;
place-self: center stretch;
}
}
16 changes: 8 additions & 8 deletions ui/app/components/app/menu-bar/menu-bar.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ export default class MenuBar extends PureComponent {

<SelectedAccount />

<Tooltip
title={t('accountOptions')}
position="bottom"
>
<div
className="menu-bar__open-in-browser"
<Tooltip title={t('accountOptions')} position="left">
<button
className="fas fa-ellipsis-v menu-bar__account-options"
title={t('accountOptions')}
onClick={() => {
this.context.metricsEvent({
eventOpts: {
Expand All @@ -43,10 +41,12 @@ export default class MenuBar extends PureComponent {
name: 'Opened Account Options',
},
})
this.setState({ accountDetailsMenuOpen: true })
this.setState((prevState) => ({
accountDetailsMenuOpen: !prevState.accountDetailsMenuOpen,
}))
}}
>
</div>
</button>
</Tooltip>

{
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/app/menu-bar/tests/menu-bar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('MenuBar', function () {
<MenuBar />
</Provider>
)
const accountOptions = wrapper.find('.menu-bar__open-in-browser')
const accountOptions = wrapper.find('.menu-bar__account-options')
accountOptions.simulate('click')
assert.equal(wrapper.find('MenuBar').instance().state.accountDetailsMenuOpen, true)
})
Expand Down
8 changes: 6 additions & 2 deletions ui/app/components/app/selected-account/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
align-items: center;
flex: 1;

&__tooltip-wrapper {
width: 100%;
}

&__name {
max-width: 200px;
width: 100%;
font-size: 1rem;
font-weight: 500;
line-height: 19px;
Expand All @@ -30,7 +34,7 @@
align-items: center;
justify-content: center;
margin: 4px 0;
padding: 6px 15px;
padding: 6px 1px;
border-radius: 10px;
cursor: pointer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class SelectedAccount extends Component {
return (
<div className="selected-account">
<Tooltip
wrapperClassName="selected-account__tooltip-wrapper"
position="bottom"
title={this.state.copied ? t('copiedExclamation') : t('copyToClipboard')}
>
Expand Down
7 changes: 0 additions & 7 deletions ui/app/css/itcss/components/account-details-dropdown.scss

This file was deleted.

2 changes: 0 additions & 2 deletions ui/app/css/itcss/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@

@import './request-decrypt-message.scss';

@import './account-details-dropdown.scss';

@import './editable-label.scss';

@import './pages/index.scss';
Expand Down

0 comments on commit 4229892

Please sign in to comment.