Skip to content

Commit

Permalink
Code cleanup for connected-indicator-info-popup
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed Apr 14, 2020
1 parent c52caf6 commit 593fdff
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 33 deletions.
2 changes: 1 addition & 1 deletion ui/app/components/ui/popover/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
}
}

&-tooltip {
&-arrow {
width: 22px;
height: 22px;
background: white;
Expand Down
4 changes: 2 additions & 2 deletions ui/app/components/ui/popover/popover.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const Popover = ({
onBack,
onClose,
className,
showTooltip,
showArrow,
CustomBackground,
}) => {
const t = useContext(I18nContext)
Expand All @@ -24,7 +24,7 @@ const Popover = ({
: <div className="popover-bg" onClick={onClose} />
}
<section className={classnames('popover-wrap', className)}>
{ showTooltip ? <div className="popover-tooltip" /> : null}
{ showArrow ? <div className="popover-arrow" /> : null}
<header className="popover-header">
<div className="popover-header__title">
<h2 title={title}>
Expand Down
22 changes: 11 additions & 11 deletions ui/app/pages/home/home.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ export default class Home extends PureComponent {
return (
<Popover
title={ t('whatsthis') }
onClose={() => setConnectedStatusPopoverHasBeenShown()}
onClose={setConnectedStatusPopoverHasBeenShown}
className="home__connected-status-popover"
showTooltip
showArrow
CustomBackground={({ onClose }) => {
return (
<div
Expand All @@ -180,20 +180,20 @@ export default class Home extends PureComponent {
</div>
)
}}
>
<main className="home__connect-status-text">
<div>{ t('metaMaskConnectStatusParagraphOne') }</div>
<div>{ t('metaMaskConnectStatusParagraphTwo') }</div>
</main>
<div className="home__connect-status-button-container">
footer={(
<Button
type="primary"
className="home__connect-status-button"
onClick={() => setConnectedStatusPopoverHasBeenShown()}
onClick={setConnectedStatusPopoverHasBeenShown}
>
{ t('dismiss') }
</Button>
</div>
)}
footerClassName="home__connected-status-popover-footer"
>
<main className="home__connect-status-text">
<div>{ t('metaMaskConnectStatusParagraphOne') }</div>
<div>{ t('metaMaskConnectStatusParagraphTwo') }</div>
</main>
</Popover>
)
}
Expand Down
25 changes: 8 additions & 17 deletions ui/app/pages/home/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@

&__connected-status-popover-bg {
height: 34px;
width: 96px;
width: 110px;
border-radius: 34px;
position: absolute;
top: 82px;
left: 18px;
left: 12px;
opacity: 1;
box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.2);
background: none;
Expand All @@ -82,24 +82,15 @@
width: 100%;
}

&__connect-status-button-container {
border-top: 1px solid #D2D8DD;
width: 100%;
display: flex;
height: 100%;
&__connect-status-popover-footer {
margin: 0;
justify-content: flex-end;
align-items: center;
padding-right: 22px;
margin-top: 20px;

.button {
button {
height: 39px;
width: 133px;
border-radius: 39px;
padding: 0;
}
}

&__connect-status-button {
height: 39px;
width: 133px;
border-radius: 39px;
}
}
4 changes: 2 additions & 2 deletions ui/app/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2182,10 +2182,10 @@ export function setMkrMigrationReminderTimestamp (timestamp) {
}

export function setConnectedStatusPopoverHasBeenShown () {
return (dispatch) => {
return () => {
background.setConnectedStatusPopoverHasBeenShown((err) => {
if (err) {
return dispatch(displayWarning(err.message))
throw new Error(err.message)
}
})
}
Expand Down

0 comments on commit 593fdff

Please sign in to comment.