-
Notifications
You must be signed in to change notification settings - Fork 7
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
feature/issue 26 header component #44
Conversation
✅ Deploy Preview for super-tapioca-5987ce ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
@Auhseh
Thanks for getting this started. I think for now as I referenced in this PR let's please avoid adding multiple unrelated changes in the one PR. This PR ideally would just be focused on the header and thus probably should only have three files added
- header.js
- header.stories.js
- header.spec.js
The storybook file in particular is of value to help develop and test the component in isolation.
I would also ask that we try and follow the contributing guidelines if possible, in particular having linting / formatting applied so we don't keep having issues with casing of filenames and formatting of files that are hard to read. Not sure if that's possible from your but it really helps on the review side of things.
Let me try and clean some things up here and get the focus on just the header component for now.
src/pages/blog/blog-landing.html
Outdated
@@ -0,0 +1,74 @@ | |||
<!DOCTYPE html> |
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.
@Auhseh
Please revert any changes unrelated to the header component please, including any static assets. Those should be done as part of another issue / PR (which I plan to work on initially)
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.
Okay, done
src/styles/main.css
Outdated
@@ -1,3 +1,23 @@ | |||
@import "https://unpkg.com/open-props"; |
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 sure if something is getting confused here, but open-props are already being defined in theme.css as well some of these global styles.
src/styles/main.css
Outdated
/**-----------------------------------------------------------------**/ | ||
|
||
|
||
/*-----BLOG STYLING--------------------------------------------------*/ |
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 my comments above re: doing multiple tasks in one PR.
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.
Yea, Sorry about this
src/components/header/header.js
Outdated
|
||
<div class="social-tray"> | ||
<li class="social-icon"> | ||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" 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.
If these are the SVGs that we already committed into the project, let me see if I can statically pull these in as text, otherwise it would be a shame to duplicate that content / code.
I'm also thinking that since only menu is interactive, that the header itself can probably be served statically and that we can create a mobile-menu component which can focus on just the interactive bits, let me try and play around with that.
src/components/header/header.js
Outdated
|
||
<header> | ||
<div class="logo-bar"> | ||
<img class="greenwood-logo" src="/assets/greenwood-logo.svg" alt="Logo"> |
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 notice this isn't the same logo from our old site, which I think was what you mentioned, so let me make a note of that and try and get the original source, though worst case scenario we can just re-use the images for now.
src/components/header/header.js
Outdated
} | ||
|
||
header { | ||
height: 5.5rem; |
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.
are we not able to leverage more open props values here instead of hardcoding our own odd values?
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.
Maybe i missed it, but the issue seems to be that open-props doesn't have values for 5.5, 11rem etc. and i can't seem to figure out how to customize with these values we have in the design.
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 will try and take a look, but i think generally most design systems work off of even values generally? What is closest to what we need vs what is open props?
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, so I think I got this into a pretty good shape and I think just a couple small issues remain which I am tracking in the description, any contributions on the mobile menu bugs or any final styling alignments would be much appreciated! 🙇
Will try and circle back by the end of the week to get this merged and knock out with some basic test cases too. 👍
Tweaked the design to fall back on the nearest open-props values. Also reflected it in the code. Only issue in the nearest future might be the Landing page Hero text which is 9.25rem (And integral to the Visual style of the page), whereas the largest open-props value seems to be 3.5rem |
Fixed bugs and mobile nav
Fixed Overlay
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.
Looking good now, and I tested these changes and the behavior looks to be working as expected now! 💯
Just found a couple refactoring / SSR tweaks to make which I will push up in a few and then I think this should be good to merge.
src/components/header/header.js
Outdated
this.shadowRoot.adoptedStyleSheets = [sheet]; | ||
|
||
// Mobile menu toggle | ||
const mobileMenu = this.shadowRoot.querySelector(".mobile-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.
looks like the optional chaining references were removed, e.g.
const mobileMenu = this.shadowRoot?.querySelector(".mobile-menu");
src/components/header/header.js
Outdated
socialTray.style.display = isMobileMenuActive ? "none" : "flex"; | ||
} | ||
|
||
mobileMenu.addEventListener("click", function () { |
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.
Will probably want to guard addEventListener
here for SSR as well, and we can probably just pass the function reference directly
closeButton?.addEventListener("click", toggleMobileMenu);
src/components/header/header.js
Outdated
} | ||
} | ||
|
||
window.addEventListener("resize", handleResize); |
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'll want to reference globalThis
in place of window
for better SSR / prerendering support
src/components/header/header.js
Outdated
toggleMobileMenu(); | ||
}); | ||
|
||
function handleResize() { |
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.
Since custom elements are classes, it might be useful for us to leverage method and members for these variables, which could help us clean up the connectedCallback
function a bit.
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.
Looking good! Just left a couple final comments but we can track those as their own issues if need be.
box-sizing: border-box; | ||
height: var(--size-10); | ||
width: auto; | ||
border: var(--border-size-1) dotted #989898ca; |
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.
@Auhseh
Just curious, I see a few of these 8 character hex values, is this a new extension in CSS? Linters and VSCode don't seem to complain but I'm probably just a little out of touch, hah.
Aside from that, it does look like there are a couple of these repeated values through this CSS, perhaps we could create some locally scoped values using :host
selector at the top of this file?
:host {
--border-color-gray: #989898ca
}
Or they can be added to theme.css if we expect to use them in other places too.
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.
Sorry for the lag here, I was unwell and I’m just now recuperating… I’m back now.
The extra two characters essentially just tweak the opacity..
The :host idea looks neat
|
||
<nav class="nav-bar"> | ||
<ul class="nav-bar-menu"> | ||
<li class="nav-bar-menu-item"> |
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.
Do we want to leverage any visited selector styles for our links? Not sure if that's best practice or not, but they do show as purple for me (naturally)
Not sure what best practices are here
cc: @aholtzman
Related Issue
#26
Summary of Changes
TODOs
<a>
tags) to navigationmobile-menu-bugs.mov
Nice to have / separate issue
queryXXX
patches - upstream feature / fixes tracking #37