Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notifications Icon Circles #7830

Merged
merged 7 commits into from
Mar 11, 2020
Merged

Notifications Icon Circles #7830

merged 7 commits into from
Mar 11, 2020

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Jan 15, 2020

This PR resolves a piece of #7389

I will be resolving that issue in parts. This first part only concerns adding the icons for toasting and notifications. It adds storybook stories for these to allow for design QA.

This PR depends on and is compared to the branch for #7688
Edit: the piece of #7688 this depended on has been merged separately as #7884, so this now targets develop

Can be QA'd by checking out the branch and and running yarn storybook.

Screen shots:
Screenshot from 2020-01-15 11-28-10
Screenshot from 2020-01-15 11-28-37
Screenshot from 2020-01-15 11-28-33
Screenshot from 2020-01-15 11-28-29

@danjm danjm changed the base branch from develop to transaction-history-updated January 15, 2020 15:01
@danjm danjm changed the base branch from transaction-history-updated to develop February 25, 2020 11:20
@metamaskbot
Copy link
Collaborator

Builds ready [3fd8a2f]
Page Load Metrics (690 ± 51 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeNotificationfirstPaint4010454199
domContentLoaded38187168810751
load38287469010751
domInteractive38187068810751

}

&__icon {
z-index: 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the z-index set on the icon? Also, why is it set both here and on line 9?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The z-index is set so that the icon appears on top of the circle, which can have a coloured background (and defaults to a white background).

You are right that it does not need to be set in two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3099a26

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to use z-index to ensure it appears on top though. It comes later in the DOM, so it'll be on top as long as it's a positioned element.

e.g.:

Suggested change
z-index: 1;
position: relative;

I'd like to avoid the use of z-index if possible, as it can lead to unexpected results with multiple elements with z-index values overlap. If we ensure things are stacked according to the DOM order, everything "just works" the way you'd expect them to.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in 47c627a

@Gudahtt
Copy link
Member

Gudahtt commented Feb 26, 2020

Do we have a use for all of these icons? We'll definitely use the error alert, but... for yellow, blue and green ones - I'm not sure we have any known use cases for blocking alerts that aren't errors 🤔

@Gudahtt
Copy link
Member

Gudahtt commented Mar 6, 2020

It seems that we do have use cases laid out for using these style of alerts for warnings and errors. Still not sure about the success and info cases though 🤔 Maybe we can leave those two out for now, until we find a use for them.

@danjm danjm force-pushed the notifications-icon-circles branch from 3fd8a2f to 27939e3 Compare March 9, 2020 15:07
@danjm
Copy link
Contributor Author

danjm commented Mar 9, 2020

@Gudahtt Removed support for the success and info icons, and corresponding stories, in 27939e3

@metamaskbot
Copy link
Collaborator

Builds ready [27939e3]
Page Load Metrics (620 ± 62 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeNotificationfirstPaint33117482311
domContentLoaded35092961812862
load35293162012862
domInteractive35092961812862

style={{
height: size,
width: size,

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Extra empty line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 47c627a

}

&__icon {
z-index: 1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to use z-index to ensure it appears on top though. It comes later in the DOM, so it'll be on top as long as it's a positioned element.

e.g.:

Suggested change
z-index: 1;
position: relative;

I'd like to avoid the use of z-index if possible, as it can lead to unexpected results with multiple elements with z-index values overlap. If we ensure things are stacked according to the DOM order, everything "just works" the way you'd expect them to.


export default class MessageCircleIcon extends Component {
static propTypes = {
type: PropTypes.string.isRequired,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: It might be helpful to be more specific here, so we're alerted if this component is used without a valid type.

Suggested change
type: PropTypes.string.isRequired,
type: PropTypes.oneOf(Object.keys(typeConfig)).isRequired,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 47c627a

@Gudahtt
Copy link
Member

Gudahtt commented Mar 10, 2020

Where does the name "message-circle-icon" come from? Would "Alert Circle Icon" be a better name? As far as I know, these are only intended for use in alerts.

@danjm
Copy link
Contributor Author

danjm commented Mar 11, 2020

@Gudahtt renamed to "alert-circle-icon" in f5a58f1

@metamaskbot
Copy link
Collaborator

Builds ready [47c627a]
Page Load Metrics (626 ± 41 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeNotificationfirstPaint33102512211
domContentLoaded4037566258541
load4057586268541
domInteractive4037566248541

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@danjm danjm merged commit 5c4831b into develop Mar 11, 2020
@whymarrh whymarrh deleted the notifications-icon-circles branch March 11, 2020 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants