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

feature/issue 26 header component #44

Merged
merged 40 commits into from
May 23, 2024
Merged

feature/issue 26 header component #44

merged 40 commits into from
May 23, 2024

Conversation

Auhseh
Copy link
Contributor

@Auhseh Auhseh commented May 5, 2024

Related Issue

#26

Summary of Changes

  1. Create Header component with Storybook and test casss
  2. Handle CSS Module Scripts support for ESLint and Vite <> Storybook

TODOs

  1. Create basic storybook file
  2. Create basic test case
  3. add site links (e.g. <a> tags) to navigation
  4. resolve image assets for Storybook
  5. use open props values in CSS / align with designs
  6. Use raw plugin to import SVGs
  7. flesh out test cases
    • check for navigation + links
    • check for logo
    • check for mobile nav
  8. Fix bugs with mobile nav
    • overlay does not hide anything
    • state gets wonky after a couple clicks
    mobile-menu-bugs.mov
  9. Vite <> Storybook integration
    • better pattern matching for constructable stylesheets
    • re-use greenwood plugins for transformation

Nice to have / separate issue

  1. dotted "track" lines - is this part of the overall layout as opposed to just the header? Maybe incorporate it into create a shared layout for all pages #32 ?
  2. Make this component light DOM based and have an interactive only mobile menu? - optimize header component for static content / Light DOM #48
  3. WCC queryXXX patches - upstream feature / fixes tracking #37
  4. get official logo from source design assets - update Greenwood logo with official logo from original source assets #47

Copy link

netlify bot commented May 5, 2024

Deploy Preview for super-tapioca-5987ce ready!

Name Link
🔨 Latest commit 620f6c3
🔍 Latest deploy log https://app.netlify.com/sites/super-tapioca-5987ce/deploys/6647b4879673660008e9df22
😎 Deploy Preview https://deploy-preview-44--super-tapioca-5987ce.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@thescientist13 thescientist13 left a 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.

@@ -0,0 +1,74 @@
<!DOCTYPE html>
Copy link
Member

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, done

@@ -1,3 +1,23 @@
@import "https://unpkg.com/open-props";
Copy link
Member

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.

/**-----------------------------------------------------------------**/


/*-----BLOG STYLING--------------------------------------------------*/
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea, Sorry about this


<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">
Copy link
Member

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.

@thescientist13 thescientist13 added docs Greenwood specific documentation enhancement New feature or request labels May 12, 2024
@thescientist13 thescientist13 linked an issue May 12, 2024 that may be closed by this pull request
7 tasks
@thescientist13 thescientist13 changed the title Create header.js feature/issue 26 header component May 12, 2024

<header>
<div class="logo-bar">
<img class="greenwood-logo" src="/assets/greenwood-logo.svg" alt="Logo">
Copy link
Member

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.

}

header {
height: 5.5rem;
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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?

@thescientist13 thescientist13 added the question Further information is requested label May 13, 2024
Copy link
Member

@thescientist13 thescientist13 left a 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. 👍

@thescientist13 thescientist13 marked this pull request as ready for review May 13, 2024 22:30
@Auhseh
Copy link
Contributor Author

Auhseh commented May 14, 2024

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

Copy link
Member

@thescientist13 thescientist13 left a 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.

this.shadowRoot.adoptedStyleSheets = [sheet];

// Mobile menu toggle
const mobileMenu = this.shadowRoot.querySelector(".mobile-menu");
Copy link
Member

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");

socialTray.style.display = isMobileMenuActive ? "none" : "flex";
}

mobileMenu.addEventListener("click", function () {
Copy link
Member

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);

}
}

window.addEventListener("resize", handleResize);
Copy link
Member

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

toggleMobileMenu();
});

function handleResize() {
Copy link
Member

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.

@thescientist13 thescientist13 removed the question Further information is requested label May 17, 2024
Copy link
Member

@thescientist13 thescientist13 left a 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;
Copy link
Member

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.

Copy link
Contributor Author

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">
Copy link
Member

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)
Screenshot 2024-05-17 at 3 56 28 PM

Not sure what best practices are here

cc: @aholtzman

@thescientist13 thescientist13 merged commit 6802dcd into main May 23, 2024
5 checks passed
@thescientist13 thescientist13 deleted the Auhseh-patch-1 branch May 23, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Greenwood specific documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Header Component
2 participants