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 81 contact page #107

Merged
merged 7 commits into from
Dec 18, 2022
Merged

Conversation

thescientist13
Copy link
Contributor

@thescientist13 thescientist13 commented Dec 11, 2022

Related Issue

resolves #81

Summary of Changes

  1. Create standard Contact Page
  2. Setup Netlify Forms
  3. Introduce Navigation component / update nav links and spec
  4. Use this.innerHTML detections so dynamic navigation link underline works

Screen Shot 2022-12-11 at 12 39 45 PM

TODO

  1. Would be nice to see if the border could match the website theme

Notes: would be nice to somehow get the page route being loaded so this would actually work in SSR mode. It's possible with Puppeteer since it s a browser, but would be nice if Greenwood could support this too at build time.

const path = typeof globalThis.location === 'undefined' ? null : globalThis.location.pathname;
const activePath = path === url;

This way, each page could statically stamp out its active status all in HTML, instead of detecting it client side. In the meantime, I wonder if it's worth doing some sort of SSR detection to avoid re-renders upon hydration?

connectedCallback() {
  const { navLinks } = this;
  
  if(this.innerHTML !== '') {
    // loop through and just set active class to active link
  } else {
    this.innerHTML = `
      <nav>
      <ul class="flex justify-center p-4 font-title text-2xl text-black-tt">
        ${
          navLinks.map((link, index) => {
            const { name, url } = link;
            const isLast = index + 1 === navLinks.length;
            const path = typeof globalThis.location === 'undefined' ? null : globalThis.location.pathname;
            const activePath = path === url;
  
            return `
              <li>
                <a
                  class="nav-link ${activePath ? 'text-orange-tt' : 'text-black-tt'} hover:text-gray-tt"
                  href="${url}"
                  title="Visit our ${name} page"
                >
                ${name}
                </a>
                <span style="margin: 0 ${isLast ? 0 : '1rem' };">${ isLast ? '' : '|'}</span>
              </li>
            `;
          }).join('')
        }
        </ul>
      </nav>
    `;
}

@thescientist13 thescientist13 merged commit aa077ff into main Dec 18, 2022
@thescientist13 thescientist13 deleted the feature/issue-81-contact-page branch December 18, 2022 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contact Page
1 participant