-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add notification component #348
Conversation
@afercia Before my code review, one visual thing: I think the box shadow of the component should be less pronounced (matching with the metabox below). |
@IreneStr yep I've noticed there's a difference in the box-shadow, however the current box-shadow is already used in the HelpCenter and matches the one in My Yoast. It's just the default one used for the
/cc @hedgefield Values: One more small difference is that this notification has a white background. However, the meta boxes have a light gray background and only the actual notifications inside the meta boxes have a white background: |
If we change the shadow in the plugin, will it still have the border? That's what makes it match the Wordpress UI. If so, go ahead and replace the shadow values with the ones from My Yoast so they're they same everywhere 👍 As for the color, Wordpress-native notifications are #fff, this one is similar, so keep it white :) |
@afercia @hedgefield One other concern: in mobile view, the notification takes up about 1/3 of the screen. Would it be a better idea to remove the image on mobile? Or maybe move the dismiss button to the top right corner to clear more space for the text? |
I agree with both suggestions, try that. There should be enough space next to the heading for the dismiss button up there (and to not have to wrap the heading - unless the heading is part of the same text area as the notification text itself...) |
@@ -0,0 +1,3 @@ | |||
<svg width="1792" height="1792" viewBox="0 0 1792 1792" xmlns="http://www.w3.org/2000/svg"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filename is not the most descriptive for the way we're using it. Maybe 'cross' is a better name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same name of the icon used on My Yoast, see client/src/icons/times.svg
. I think we should be consistent and keep it as is or change it also on My Yoast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, okay. Let's keep it this way 👌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a fun one, I can also never find it in fontawesome because of that name 😄 it doesn't really match how the icon is being used on the web today. But while we're sourcing from fontawesome we best keep it the same yeah.
@@ -5,3 +5,4 @@ export { default as angleRight } from "./angle-right.svg"; | |||
export { default as angleUp } from "./angle-up.svg"; | |||
export { default as angleDown } from "./angle-down.svg"; | |||
export { default as questionCircle } from "./question-circle.svg"; | |||
export { default as times } from "./times.svg"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See below
const messages = defineMessages( { | ||
buttonAriaLabel: { | ||
id: "notification.buttonAriaLabel", | ||
defaultMessage: "Dismiss this notice", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've discussed semantics with @jcomack. Please change to 'notification' ('notice' = warning)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used this text because it's the standard text used in WordPress: Dismiss this notice.
No objections in changing it, however users will hear different text when navigating through the interface, sometimes Dismiss this notice.
and sometimes Dismiss this notification.
🙂 Not sure hte change will add a great value, at the cost of some potential confusion.
/cc @jcomack
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's keep this consistent with WP: notice
composites/basic/Notification.js
Outdated
const NotificationImage = styled.img` | ||
flex: 0 0 ${ props => props.imageWidth ? props.imageWidth : "auto" }; | ||
height: ${ props => props.imageHeight ? props.imageHeight : "auto" }; | ||
margin-right: 18px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hedgefield prefers 16px to fit the 8px grid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: in the provided mockup, the distance is 20px. I've use 18px to compensate the font metrics. If you measure the distance from the rendered image and the rendered title, it's 20px.
Are we sure we want to change this? The meta boxes below use a 20px padding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To clarify: font metrics and font rendering engines matter. If we use a distance (whether it's padding or margin) between the image and the text, this applies to the text container. The actual text is rendered with a few pixel distance from its container, and that's normal on the web, it just works this way. It also depends on the actual font face used and even from the shape of the first letter:
Setting the exact same value on the left and on the right, will actually result in an uneven perceived spacing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting, so 18px is actually 20px visually? I hadn't heard about that before. Is this compensated consistently throughout our existing UI? If so, okay, otherwise, I'd prefer coding consistency over a small visual inconsistency.
composites/basic/Notification.js
Outdated
const NotificationContainer = styled.div` | ||
display: flex; | ||
align-items: center; | ||
padding: 20px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
24px in desktop, 16px in mobile view
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to fit the 8px grid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change wouldn't match the provided design, see #347. I've measured the padding in the mockup, and it's 20 px, I guess also to match the padding of the notifications in the meta boxes below.
Are we sure we want to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The margins in the mockup are an approximation, they haven't been measured out, I'll keep that in mind next time. I would prefer they all adhere to the 24/16 @IreneStr proposed.
No, because the My Yoast style used for the "Paper" in the Help Center and in the new notification doesn't have a border. If we want the styles to match, the border should be removed, or the My Yoast style changed. Re: containers/notices styling, here's the current situation:
They match except for the background. Our background is a light gray because we're using notices with a white background inside these containers. Aside; I'm not sure I like the white on (almost) white effect 🙂
The box-shadow doesn't match.
This box-shadow is completely different because it uses the "My Yoast" style. As I see it, there are 2 options:
As I see it, 2) would defeat a bit the purpose of reusable components. Basically all the Yoast components should slightly differentiate some small design details when used on WP or My Yoast. Not sure this is the direction we want to take but can certainly be done if really necessary. |
I agree, keeping it reusable across all products is best. I just want to be careful that we don't deviate too much from the wordpress look, intense drop shadows don't really fit there. The help center one is too much. Use the yoast alert one for now. I'll make a separate issue to fix the shadows across all the things, in wp and in my yoast. I agree nesting papers is not good, this will get better in time. 🙃 |
Latest changes implement the 24/16 pixels padding and change the box-shadow as requested:
|
CR done 👍 |
Acceptance done 👍 |
Added Components Notification component. #348 AnalysisResult component. #352 ContentAnalysis component. #359 Other additions Added callbacks to notify tab switch in YoastTabs. #346 setSeoResultsForKeyword action and reducer implementation. #355 Added default className to VideoDescriptionItem component. #358
Summary
This PR can be summarized in the following changelog entry:
Relevant technical choices:
Test instructions
Use the code below in ContentAnalysis.
Play a bit changing the props, removing
imageSrc
, removingisDismissable
, etc.Test in responsive view.
Screenshots:
Quick testing integration in WordPress (just pasting the rendered HTML and stylesheets in the DOM):
Fixes #347