-
Notifications
You must be signed in to change notification settings - Fork 3
Feature: Convert menus to JSON #195
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
Merged
+182
−136
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c6682ae
Replaced primary menu
colinmurphy d801d87
Added footer menus
colinmurphy 8f87253
Hardcoded header links
colinmurphy e388fea
Hardcoded footer menus
colinmurphy e2e7b89
Removed keys and target _blank as per code review
colinmurphy 9a7e6dd
Fixed path for discord
colinmurphy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,11 @@ | ||
| import { gql, useQuery } from "@apollo/client"; | ||
| import Link from "@/components/link"; | ||
|
|
||
| export default function Footer() { | ||
| const { data, loading, error } = useQuery(GET_FOOTER_NAV_ITEMS); | ||
|
|
||
| if (loading) return <p>Loading...</p>; | ||
| if (error) return <p>Error! {error.message}</p>; | ||
|
|
||
| return ( | ||
| <footer className="bg-gray-950 px-8 pb-14 lg:px-16 lg:pb-24"> | ||
| <div className="container-main container prose prose-invert border-t border-gray-900"> | ||
| <div className="grid grid-cols-1 gap-8 pt-14 sm:grid-cols-2 lg:grid-cols-3 lg:pt-24"> | ||
| <FooterColumns data={data} /> | ||
| <FooterColumns /> | ||
| </div> | ||
| <div className="mt-24 text-gray-500"> | ||
| <p> | ||
|
|
@@ -42,91 +36,156 @@ export default function Footer() { | |
| ); | ||
| } | ||
|
|
||
| function FooterColumns({ data }) { | ||
| const { footer1MenuItems, footer2MenuItems, footer3MenuItems } = data; | ||
| const columns = [ | ||
| footer1MenuItems?.menuItems?.nodes, | ||
| footer2MenuItems?.menuItems?.nodes, | ||
| footer3MenuItems?.menuItems?.nodes, | ||
| ]; | ||
|
|
||
| return columns.map((column, index) => { | ||
| if (!column || column.length === 0) { | ||
| return; // Skip rendering if no menu items are found | ||
| } | ||
|
|
||
| const columnTitle = column[0]?.menu?.node?.name || "Menu"; | ||
| function FooterColumns() { | ||
| const columnClass = "col-span-1 flex flex-col gap-4"; | ||
| const listClass = "my-0 list-none ps-0"; | ||
| const headingClass = "font-bold uppercase tracking-wider text-gray-300"; | ||
| const listItemClass = "my-0 space-y-2 ps-0"; | ||
| const linkClass = | ||
| "inline-flex items-center gap-1 font-normal text-gray-400 no-underline transition duration-150 ease-in-out hover:text-gray-200"; | ||
|
|
||
| return ( | ||
| <div className="col-span-1 flex flex-col gap-4" key={index}> | ||
| <h6 className="font-bold uppercase tracking-wider text-gray-300"> | ||
| {columnTitle} | ||
| </h6> | ||
| <ul className="my-0 list-none ps-0"> | ||
| {column.map((item) => ( | ||
| <li className="my-0 space-y-2 ps-0" key={item.id}> | ||
| <Link | ||
| className="inline-flex items-center gap-1 font-normal text-gray-400 no-underline transition duration-150 ease-in-out hover:text-gray-200" | ||
| href={item.uri} | ||
| noDefaultStyles | ||
| target={item.target} | ||
| > | ||
| {item.label} | ||
| </Link> | ||
| </li> | ||
| ))} | ||
| return ( | ||
| <> | ||
| <div className={columnClass} key="downloads"> | ||
| <h6 className={headingClass}>Downloads</h6> | ||
| <ul className={listClass}> | ||
| <li className={listItemClass} key="faustwp-cli"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://www.npmjs.com/package/@faustwp/cli" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| @faustwp/cli | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="faustwp-core"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://www.npmjs.com/package/@faustwp/core" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| @faustwp/core | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="faustwp-blocks"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://www.npmjs.com/package/@faustwp/blocks" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| @faustwp/blocks | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="faustwp-companion-plugin"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://github.com/wpengine/faustjs/tree/canary/plugins/faustwp" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| Faust.js Companion Plugin | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="wpgraphql-content-blocks"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://github.com/wpengine/wp-graphql-content-blocks" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| WPGraphQL Content Blocks | ||
| </Link> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| <div className={columnClass} key="community"> | ||
|
||
| <h6 className={headingClass}>Community</h6> | ||
| <ul className={listClass}> | ||
| <li className={listItemClass} key="github"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://github.com/wpengine/faustjs?ref=faustjs" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| Github | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="twitter"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://twitter.com/wpengine" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="youtube"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://www.youtube.com/channel/UCh1WuL54XFb9ZI6m6goFv1g" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| YouTube | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="discord"> | ||
| <Link | ||
| className={linkClass} | ||
| href="/discord/" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| Discord | ||
| </Link> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| <div className={columnClass} key="wpengine"> | ||
| <h6 className={headingClass}>WP Engine</h6> | ||
| <ul className={listClass}> | ||
| <li className={listItemClass} key="privacy-policy"> | ||
| <Link className={linkClass} href="/privacy-policy/" noDefaultStyles> | ||
| Privacy Policy | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="developers"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://wpengine.com/builders/headless" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| Developers | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="hiring"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://wpengine.careers/?ref=faustjs" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| We're Hiring! | ||
| </Link> | ||
| </li> | ||
| <li className={listItemClass} key="headless-hosting"> | ||
| <Link | ||
| className={linkClass} | ||
| href="https://wpengine.com/atlas?ref=faustjs" | ||
| noDefaultStyles | ||
| target="_blank" | ||
| > | ||
| Headless Hosting | ||
| </Link> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| ); | ||
| }); | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| const GET_FOOTER_NAV_ITEMS = gql` | ||
| query GetFooterNavItems { | ||
| footer1MenuItems: menu(id: "downloads", idType: NAME) { | ||
| menuItems { | ||
| nodes { | ||
| id | ||
| uri | ||
| label | ||
| target | ||
| menu { | ||
| node { | ||
| name | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| footer2MenuItems: menu(id: "community", idType: NAME) { | ||
| menuItems { | ||
| nodes { | ||
| id | ||
| uri | ||
| label | ||
| target | ||
| menu { | ||
| node { | ||
| name | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| footer3MenuItems: menu(id: "WP engine", idType: NAME) { | ||
| menuItems { | ||
| nodes { | ||
| id | ||
| uri | ||
| label | ||
| target | ||
| menu { | ||
| node { | ||
| name | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| `; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 handled by the component.