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

optimize header component for static content / Light DOM #48

Closed
thescientist13 opened this issue May 13, 2024 · 1 comment · Fixed by #73
Closed

optimize header component for static content / Light DOM #48

thescientist13 opened this issue May 13, 2024 · 1 comment · Fixed by #73
Assignees
Labels
enhancement New feature or request

Comments

@thescientist13
Copy link
Member

Summary

Coming out of #26 / #44 we started with instrumenting the header component to render out purely into (Declarative) Shadow DOM. Thinking about it more, since only the mobile menu tile icon is interactive, we can probably componentize just that part, and leave the bulk of the header to just be rendered out as static (Light DOM) HTML

Details

So basically:

  1. the overlay / mobile menu nav should be a component, that can render into a Declarative Shadow Root
  2. From there, we would only need to ship the mobile menu component JS
@thescientist13 thescientist13 added the enhancement New feature or request label May 13, 2024
@thescientist13 thescientist13 added the docs Greenwood specific content like docs and guides label May 13, 2024
@thescientist13
Copy link
Member Author

thescientist13 commented Jul 4, 2024

Wow, totally realized we should be able to replace pretty much everything in the header with a Popover! 🍿

We can just apply the popover attribute to the mobile nav element using auto so then we can have our close <button>

<nav class="nav-bar-mobile" id="my-popover" popover="manual">
  <button class="close-button" popovertarget="my-popover" popovertargetaction="hide">
    &times;
  </button>
  
  <ul class="mobile-menu-items">
    <!-- ... -->
</nav>

And then wire it up to our mobile menu icon

<button class="mobile-menu" popovertarget="my-popover">
  ${mobileMenuIcon}
</button>

We can then style the popover ourselves to reproduce our overlay.

Screenshot 2024-07-04 at 3 10 26 PM

In addition, we should really be able refactor all the JS resize logic away with just media queries right? Or at the very least, with this we should be able to.

Maybe we could re-use the HTML for both menus too (or just make the nav a template)? 🤔


We should do this after #64 lands (and #67 + #61), and then as a by-product, should also resolve these issues in one fell swoop

@thescientist13 thescientist13 self-assigned this Jul 4, 2024
@thescientist13 thescientist13 changed the title optimize header component for Light DOM and SSG optimize header component for static content / Light DOM Jul 4, 2024
@thescientist13 thescientist13 removed the docs Greenwood specific content like docs and guides label Jul 4, 2024
@thescientist13 thescientist13 moved this from 🔖 Ready to 🏗 In progress in [Greenwood] Website Redesign and Relaunch Jul 11, 2024
@thescientist13 thescientist13 moved this from 🏗 In progress to 👀 In review in [Greenwood] Website Redesign and Relaunch Jul 11, 2024
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in [Greenwood] Website Redesign and Relaunch Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant