-
Notifications
You must be signed in to change notification settings - Fork 359
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
Skatepark: add the header #4354
Conversation
|
||
<!-- wp:group --> | ||
<div class="wp-block-group nav-links"><!-- wp:navigation {"orientation":"horizontal","itemsJustification":"right","isResponsive":true,"style":{"typography":{"fontStyle":"normal","fontWeight":"900","textTransform":"uppercase"}},"fontSize":"small"} --> | ||
<!-- wp:navigation-link {"label":"Home","type":"custom","url":"http://skateparkdev.local/","kind":"custom","isTopLevelLink":true} /--> |
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.
Not suggesting we ship the theme with these links baked in, but I included them so it's maybe easier to test.
align-items: center; | ||
|
||
&::after { | ||
content: "Menu"; |
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.
We can't translate 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.
Could we use the lang attribute on the html
tag to translate this? Something like:
html[lang="en-US"] {
.nav-links {
.wp-block-navigation__responsive-container-open {
&::after {
content: "Menu";
}
}
}
}
I guess this would need to be added via a PHP template in an inline style.. Or is this horrible and hacky?
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.
we could add this line of CSS as inline inside functions.php and wrap the string around the PHP translation function directly, no need to target the lang attribute. It's not much better, but it's another option
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 nice ok! Well, we have options 😄
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.
Ideally there is an option in the nav block itself to provide this label next to the responsive hamburger. I wonder if it's planned
I love how this looks! And it's very simple, great job! This is what I see: The social icons could have the same treatment as the footer block so that they align with the menu. In this particular case, I'd add a class to the block, since the users may want to re build the header or use another theme's and we don't want the css to break that. This is what the footer is doing:
If either the navigation or the social links are not present, this happens. The scenario with no social links is worth considering. And right now Skatepark doesn't support a site logo, should we add support for it, @melchoyce If so, should we copy Quadrat's behavior for it? |
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 looks ace! Agree with @MaggieCabrera's comments. Looking good in all browsers and resolutions. I agree with needing to use the media query for the navigation and social links, I can't think of another way we could do this.
> * { // Apply a stack layout (page 69 of the every-layout.dev PDF) | ||
margin-top: 20px; | ||
margin-bottom: 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.
This is cool, I love the idea of styling the context rather than the element itself.
align-items: center; | ||
|
||
&::after { | ||
content: "Menu"; |
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.
Could we use the lang attribute on the html
tag to translate this? Something like:
html[lang="en-US"] {
.nav-links {
.wp-block-navigation__responsive-container-open {
&::after {
content: "Menu";
}
}
}
}
I guess this would need to be added via a PHP template in an inline style.. Or is this horrible and hacky?
Whoo 🎉 Minor notes:
Yes and yes, though I think I'll want to test once we have Quadrat's behavior in Skatepark. |
dfe8214
to
f3b4de4
Compare
skatepark/functions.php
Outdated
@@ -40,5 +40,13 @@ function skatepark_support() { | |||
function skatepark_scripts() { | |||
// Enqueue front-end styles. | |||
wp_enqueue_style( 'skatepark-styles', get_stylesheet_directory_uri() . '/assets/theme.css', array( 'blockbase-ponyfill' ), wp_get_theme()->get( 'Version' ) ); | |||
|
|||
// Allow the responsive menu label to be translated. | |||
$menu_label_css = ' |
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 feels very messy, which makes me think it should go in the block.
In the meantime, maybe it should live in blockbase.
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.
but blockbase doesn't have the Menu text. I think this is probably planned for the navigation block
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.
Ok, I'm going to remove it from the theme for now and open an issue for it in Gutenberg.
@@ -381,7 +381,8 @@ | |||
}, | |||
"core/navigation": { | |||
"typography": { | |||
"fontSize": "var(--wp--preset--font-size--normal)" | |||
"fontSize": "var(--wp--preset--font-size--normal)", | |||
"letterSpacing": "0.05em" |
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.
@melchoyce I added the letter spacing for all navigation blocks — is that okay, or do you think it should be targeted to the navigation block in the header only?
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.
Also 0.1em for letter spacing looked like a lot compared to the comps, so I used 0.05 but let me know if you think it should be 0.1em.
Thanks for the reviews and comments! I made the following changes:
I think this is ready for another review, be sure to test out adding a logo. |
Can we swap out the menu icon for a slightly thicker, three-bar version? And if possible, open the menu underneath instead of overlaying the header: If that's not possible, we can keep as-is — just feels especially annoying to open the menu on the left side and then close it on the right. Also happy with us playing with this later in a new PR. |
@melchoyce any guidance on the position of the logo across viewports? The header on Quadrat is different so I wasn't sure how to handle.
I think this will be tricky / I'm not sure if it's possible with the nav block currently. We can at least move the position of the close button within the modal so it's the same location as the open button. |
Just adding that this also closes #4319 since I don't think we need a separate issue for that |
9534e37
to
e8ec881
Compare
I gave this a try. Unless there is a purely flex based approach that I am missing, I don't think it's worth it because it would require another group block and more media-query based CSS, which is very fragile when we open things to the site editor.
I opened a small change in Gutenberg to allow this so we don't have to add CSS for it and the user can customize it: WordPress/gutenberg#33983 I also removed the responsive menu label in favor of adding the ability to the nav block itself: WordPress/gutenberg#33985 Thoughts on bringing this in and iterating? |
This is looking good for me in all browsers and resolutions. I've tested with and without both a logo and a menu. Bringing this in and iterating sounds good to me. |
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.
+1 on bringing this in and iterating. And I also agree that the menu label is best handled on the editor.
Changes proposed in this Pull Request:
This PR adds a header template part and styles per the design for Skatepark. It applies some ideas from the every-layout.dev book. It was pretty interesting to explore and grok the concept of truly flexible layouts not tied to breakpoints.
Looking at Skatepark's header design and the components involved, there are three states to consider:
B is the interesting scenario. Before, I would have tried to write a media query that tells the header to break onto two lines at a specific pixel value. But this is not a great approach because we don't know for certain the content width / number of menu items, thus making it impossible to write a media query that solves for all the situations.
I could not get around using a media query for the navigation + social links, which I think is acceptable because the navigation block's responsive behavior is tied to the same media query.
The spacing needs some tightening to match the comps, but I wanted to get your feedback in the meantime.
Related issue(s):
#4313