mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 01:47:00 +01:00
Whats new popup design fixes (#10964)
* Remove padding on QR code image * Allow the qr code to be below the description in the whats new popup * Fix size and position of QR code in whats new notification * Add right caret to action links in whats new popup * Clean up placeImageBelowDescription logic * Fix display of whats-new-popup image * Improve spacing and sizing of whats new popup in both full screen and popup view * refactor
This commit is contained in:
parent
d12349046f
commit
a082a2ca75
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@ -5,8 +5,9 @@ export const UI_NOTIFICATIONS = {
|
|||||||
date: '2021-03-17',
|
date: '2021-03-17',
|
||||||
image: {
|
image: {
|
||||||
src: 'images/mobile-link-qr.svg',
|
src: 'images/mobile-link-qr.svg',
|
||||||
height: '270px',
|
height: '230px',
|
||||||
width: '270px',
|
width: '230px',
|
||||||
|
placeImageBelowDescription: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
2: {
|
2: {
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__notification-image {
|
&__notification-image {
|
||||||
|
align-self: center;
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,3 +50,14 @@
|
|||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.popover-wrap.whats-new-popup__popover {
|
||||||
|
@media screen and (min-width: 576px) {
|
||||||
|
max-height: 600px;
|
||||||
|
width: 500px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (max-width: 575px) {
|
||||||
|
max-height: 568px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -32,6 +32,15 @@ function getActionFunctionById(id) {
|
|||||||
const renderFirstNotification = (notification, idRefMap) => {
|
const renderFirstNotification = (notification, idRefMap) => {
|
||||||
const { id, date, title, description, image, actionText } = notification;
|
const { id, date, title, description, image, actionText } = notification;
|
||||||
const actionFunction = getActionFunctionById(id);
|
const actionFunction = getActionFunctionById(id);
|
||||||
|
const imageComponent = image && (
|
||||||
|
<img
|
||||||
|
className="whats-new-popup__notification-image"
|
||||||
|
src={image.src}
|
||||||
|
height={image.height}
|
||||||
|
width={image.width}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
const placeImageBelowDescription = image?.placeImageBelowDescription;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classnames(
|
className={classnames(
|
||||||
@ -40,14 +49,7 @@ const renderFirstNotification = (notification, idRefMap) => {
|
|||||||
key={`whats-new-popop-notificatiion-${id}`}
|
key={`whats-new-popop-notificatiion-${id}`}
|
||||||
ref={idRefMap[id]}
|
ref={idRefMap[id]}
|
||||||
>
|
>
|
||||||
{image && (
|
{!placeImageBelowDescription && imageComponent}
|
||||||
<img
|
|
||||||
className="whats-new-popup__notification-image"
|
|
||||||
src={image.src}
|
|
||||||
height={image.height}
|
|
||||||
width={image.width}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div className="whats-new-popup__notification-title">{title}</div>
|
<div className="whats-new-popup__notification-title">{title}</div>
|
||||||
<div className="whats-new-popup__description-and-date">
|
<div className="whats-new-popup__description-and-date">
|
||||||
<div className="whats-new-popup__notification-description">
|
<div className="whats-new-popup__notification-description">
|
||||||
@ -55,6 +57,7 @@ const renderFirstNotification = (notification, idRefMap) => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="whats-new-popup__notification-date">{date}</div>
|
<div className="whats-new-popup__notification-date">{date}</div>
|
||||||
</div>
|
</div>
|
||||||
|
{placeImageBelowDescription && imageComponent}
|
||||||
{actionText && (
|
{actionText && (
|
||||||
<Button
|
<Button
|
||||||
type="secondary"
|
type="secondary"
|
||||||
@ -88,7 +91,7 @@ const renderSubsequentNotification = (notification, idRefMap) => {
|
|||||||
</div>
|
</div>
|
||||||
{actionText && (
|
{actionText && (
|
||||||
<div className="whats-new-popup__link" onClick={actionFunction}>
|
<div className="whats-new-popup__link" onClick={actionFunction}>
|
||||||
{actionText}
|
{`${actionText} >`}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -160,7 +163,6 @@ export default function WhatsNewPopup({ onClose }) {
|
|||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
popoverRef={popoverRef}
|
popoverRef={popoverRef}
|
||||||
mediumHeight
|
|
||||||
>
|
>
|
||||||
<div className="whats-new-popup__notifications">
|
<div className="whats-new-popup__notifications">
|
||||||
{notifications.map(({ id }, index) => {
|
{notifications.map(({ id }, index) => {
|
||||||
|
@ -18,10 +18,6 @@
|
|||||||
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
|
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25);
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
background: white;
|
background: white;
|
||||||
|
|
||||||
&--medium-height {
|
|
||||||
max-height: 600px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-header {
|
&-header {
|
||||||
|
@ -13,7 +13,6 @@ const Popover = ({
|
|||||||
onBack,
|
onBack,
|
||||||
onClose,
|
onClose,
|
||||||
className,
|
className,
|
||||||
mediumHeight,
|
|
||||||
contentClassName,
|
contentClassName,
|
||||||
showArrow,
|
showArrow,
|
||||||
CustomBackground,
|
CustomBackground,
|
||||||
@ -28,9 +27,7 @@ const Popover = ({
|
|||||||
<div className="popover-bg" onClick={onClose} />
|
<div className="popover-bg" onClick={onClose} />
|
||||||
)}
|
)}
|
||||||
<section
|
<section
|
||||||
className={classnames('popover-wrap', className, {
|
className={classnames('popover-wrap', className)}
|
||||||
'popover-wrap--medium-height': mediumHeight,
|
|
||||||
})}
|
|
||||||
ref={popoverRef}
|
ref={popoverRef}
|
||||||
>
|
>
|
||||||
{showArrow ? <div className="popover-arrow" /> : null}
|
{showArrow ? <div className="popover-arrow" /> : null}
|
||||||
@ -84,7 +81,6 @@ Popover.propTypes = {
|
|||||||
contentClassName: PropTypes.string,
|
contentClassName: PropTypes.string,
|
||||||
className: PropTypes.string,
|
className: PropTypes.string,
|
||||||
showArrow: PropTypes.bool,
|
showArrow: PropTypes.bool,
|
||||||
mediumHeight: PropTypes.bool,
|
|
||||||
popoverRef: PropTypes.shape({
|
popoverRef: PropTypes.shape({
|
||||||
current: PropTypes.instanceOf(window.Element),
|
current: PropTypes.instanceOf(window.Element),
|
||||||
}),
|
}),
|
||||||
|
Loading…
Reference in New Issue
Block a user