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

Marketing site header #21

Merged
merged 68 commits into from Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d08eb4d
updating footer structure and content to match new marketing site
May 8, 2019
0cf1134
removing events display from homepage
May 8, 2019
bb113d9
removing all events and gql query for events
May 8, 2019
bf6d706
addressing PR feedback
May 9, 2019
068f18a
refactoring menus
May 9, 2019
579eaf3
styling and markup for reg pages
May 9, 2019
1791ae2
more styling and api version
May 9, 2019
82e16d1
styling fix
May 10, 2019
c71eaf5
add missing link
May 10, 2019
203a2d2
fix post rebase footer
Jul 8, 2019
eb5fe61
configuring and light styling primary links
Jul 8, 2019
bda4892
configuring and light styling utility links
Jul 8, 2019
c03a3d1
styling sub menus
Jul 11, 2019
0bd1115
more styling sub menus
Jul 11, 2019
8d952ea
products menus and megamenu clicks
Jul 12, 2019
ff0519a
drop down behavior
Jul 12, 2019
00977eb
adjust padding
Jul 12, 2019
ce5502c
add sub menus icons and descriptions
Jul 14, 2019
0d99973
typography updates
Jul 14, 2019
b1398d6
submenus refactoring and architecture
Jul 15, 2019
ad5b3b2
wrap products menu and stles adjustments
Jul 16, 2019
a99ac1b
add community menus
Jul 16, 2019
2d5af3b
better accessibility
Jul 16, 2019
e2fc5fb
better accessibility
Jul 16, 2019
a87b965
change names
Jul 16, 2019
79c9b5b
change names
Jul 16, 2019
a1c0f8c
style updates
Jul 16, 2019
ca9a610
update styles and markup for consistency
Jul 22, 2019
2a49261
coordinate styles with docs
Jul 24, 2019
ae236ab
post rebase fixes
Jul 31, 2019
f6f685f
fix rebase regressions
Aug 1, 2019
1d228e2
new logo and adjusting padding
Aug 1, 2019
a6ee12b
adjusting styles to match
Aug 1, 2019
4a2539c
mobile menus switches
Aug 1, 2019
72a28aa
add mobile menus
Aug 1, 2019
a0b8b3b
mobile menu scripts and styling
Aug 1, 2019
8e20ae3
adjustements bc of community
Aug 2, 2019
7803033
header spacing adjustemnt
Aug 2, 2019
c518697
styles update
Aug 2, 2019
09980f2
mobile menus updates
Aug 2, 2019
be9ce30
mobile menus updates part 2
Aug 2, 2019
fc54b95
add all producst links and more styling
Aug 8, 2019
77169e7
add mobile sign up button
Aug 8, 2019
7199a95
cherry picking footer changes from other branch
Aug 9, 2019
0d06c28
small chabge to logo wrapper
Aug 9, 2019
17347fe
updating links, removing old links
Aug 12, 2019
7f9f26d
post rebase fixes
Sep 26, 2019
cb27283
fix dropdowns
Sep 26, 2019
5ec4ec4
update logo
Sep 30, 2019
e43dca6
update mobile styles
Sep 30, 2019
8b1f681
update mobile styles part 2
Sep 30, 2019
a8697fb
correct height
Sep 30, 2019
be731e0
regression fixes
Sep 30, 2019
b4f09de
regression fixes part 2
Sep 30, 2019
8e2cbf6
slight modif to mid breakpoint primary nav
Oct 1, 2019
02375a4
adjustments to footer content & styles
Sep 30, 2019
1f94ced
adding mobile styles
Sep 30, 2019
bc3e6ed
removing tailwind refs and adding as regular css instead
Oct 1, 2019
968f410
update logo
Oct 1, 2019
9735ed7
update home link
Oct 1, 2019
9027c78
update logo again
Oct 1, 2019
430ba21
whoops missing rem
Oct 1, 2019
eb40f53
fix @screen ref
Oct 1, 2019
ed7b6c3
style updates
Oct 1, 2019
461429f
style changes
Oct 7, 2019
e3d9085
updaing paths to us prod API
Oct 7, 2019
3f71d28
update footer and search links to point to prod
Oct 7, 2019
22848a4
remove target blank from footer menus links
Oct 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion gatsby-config.js
Expand Up @@ -2,7 +2,7 @@ module.exports = {
siteMetadata: {
title: `Linode Developer Tools`,
description: `Linode API Documentation, Guides, and Tools`,
menuLinks: [
dlcLinks: [
{
name: "API Documentation",
link: "/api/v4"
Expand Down Expand Up @@ -95,7 +95,9 @@ module.exports = {
options: {
tailwind: true,
whitelist: [
"mobile",
"mobile-nav",
"sign-up",
"active",
"active-item",
"error",
Expand Down
181 changes: 137 additions & 44 deletions gatsby-node.js
Expand Up @@ -2,6 +2,7 @@ const JsonSchemaRefParser = require("json-schema-ref-parser");
const path = require("path");
const _ = require("lodash");
const fs = require("fs");
const axios = require("axios");

const specs = require("./static/api/docs/v4/spec.json");
const crypto = require("crypto");
Expand All @@ -13,6 +14,7 @@ exports.sourceNodes = async ({ actions }) => {
const { createNode, createTypes } = actions;
const res = await parser.dereference(specs);

// CREATING NODES FROM API SPECS
const typeDefs = `
type MarkdownRemark implements Node {
frontmatter: Frontmatter!
Expand All @@ -26,55 +28,146 @@ exports.sourceNodes = async ({ actions }) => {

createTypes(typeDefs);

// map into these results and create nodes
Object.keys(res.paths).map((path, i) => {
// Create your node object
const modes = {
get: "get",
post: "post",
put: "put",
delete: "delete"
};
const pathNode = {
// Required fields
id: `${i}`,
parent: `__SOURCE__`,
internal: {
type: `Paths` // name of the graphQL query --> allRandomUser {}
// contentDigest will be added just after
// but it is required
},
children: [],
const allSpecs =
// map into these results and create nodes
Object.keys(res.paths).map(async (path, i) => {
// Create your node object
const pathNode = {
// Required fields
id: `${i}`,
parent: `__SOURCE__`,
internal: {
type: `Paths` // name of the graphQL query --> allRandomUser {}
},
children: [],

// Other fields that you want to query with graphQl
name: path,
get: res.paths[path].get,
post: res.paths[path].post,
put: res.paths[path].put,
delete: res.paths[path].delete,
responses: res.paths[path].responses,
requestBody: res.paths[path].requestBody,
parameters: res.paths[path].parameters,
tagGroup:
(res.paths[path]["get"] && res.paths[path]["get"].tags) ||
(res.paths[path]["put"] && res.paths[path]["put"].tags) ||
(res.paths[path]["post"] && res.paths[path]["post"].tags) ||
(res.paths[path]["delete"] && res.paths[path]["delete"].tags)
};
// Other fields that you want to query with graphQl
name: path,
get: res.paths[path].get,
post: res.paths[path].post,
put: res.paths[path].put,
delete: res.paths[path].delete,
responses: res.paths[path].responses,
requestBody: res.paths[path].requestBody,
parameters: res.paths[path].parameters,
tagGroup:
(res.paths[path]["get"] && res.paths[path]["get"].tags) ||
(res.paths[path]["put"] && res.paths[path]["put"].tags) ||
(res.paths[path]["post"] && res.paths[path]["post"].tags) ||
(res.paths[path]["delete"] && res.paths[path]["delete"].tags)
};

// Get content digest of node. (Required field)
const contentDigest = crypto
.createHash(`md5`)
.update(JSON.stringify(pathNode))
.digest(`hex`);
// add it to userNode
pathNode.internal.contentDigest = contentDigest;
// Get content digest of node. (Required field)
const contentDigest = crypto
.createHash(`md5`)
.update(JSON.stringify(pathNode))
.digest(`hex`);
// add it to userNode
pathNode.internal.contentDigest = contentDigest;

// Create node with the gatsby createNode() API
createNode(pathNode);
// Create node with the gatsby createNode() API
createNode(pathNode);
});

const baseUrl =
"https://linode.com/wp-json/menus/v1/menus";

// CREATING MENU NODES FROM WP API
const wpMenus = [
{
path: `${baseUrl}/header-utility`,
name: "HeaderUtility"
},
{
path: `${baseUrl}/header-primary`,
name: "HeaderPrimary"
},
{
path: `${baseUrl}/submenu-why-linode-primary`,
name: "WhyPrimary"
},
{
path: `${baseUrl}/submenu-why-linode-services`,
name: "WhyServices"
},
{
path: `${baseUrl}/submenu-products-featured`,
name: "ProductsFeatured"
},
{
path: `${baseUrl}/submenu-products-compute`,
name: "ProductsCompute"
},
{
path: `${baseUrl}/submenu-products-storage`,
name: "ProductsStorage"
},
{
path: `${baseUrl}/submenu-products-services`,
name: "ProductsServices"
},
{
path: `${baseUrl}/submenu-products-networking`,
name: "ProductsNetworking"
},
{
path: `${baseUrl}/submenu-products-developer-tools`,
name: "ProductsDevTools"
},
{
path: `${baseUrl}/submenu-community-primary`,
name: "CommunityPrimary"
},
{
path: `${baseUrl}/submenu-community-secondary`,
name: "CommunityServices"
},
{
path: `${baseUrl}/submenu-mobile-primary`,
name: "PrimaryMobile"
},
{
path: `${baseUrl}/submenu-mobile-utility`,
name: "UtilityMobile"
}
];

const allMenus = wpMenus.map(async menu => {
const endpoint = () => axios.get(menu.path);
// await for results
const list = await endpoint();

list.data.items.map((menuItem, i) => {
// Create your node object
const itemNode = {
// Required fields
id: `${i}`,
parent: `__SOURCE__`,
internal: {
type: menu.name
},
children: [],
title: menuItem.title,
url: menuItem.url,
switch_on: menuItem.switch_on ? menuItem.switch_on : undefined,
description: menuItem.description ? menuItem.description : undefined,
icon: menuItem.icon ? menuItem.icon : undefined
};

// Get content digest of node. (Required field)
const contentDigest = crypto
.createHash(`md5`)
.update(JSON.stringify(itemNode))
.digest(`hex`);
// add it to userNod e
itemNode.internal.contentDigest = contentDigest;

// Create node with the gatsby createNode() API
return createNode(itemNode);
});
});

return;
return Promise.all(allMenus, allSpecs);
};

exports.createPages = async ({ actions, graphql }) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -6,7 +6,7 @@
"author": "Alban Bailly <abailly@linode.com>",
"dependencies": {
"@gatsby-contrib/gatsby-plugin-elasticlunr-search": "^2.2.1",
"axios": "^0.18.0",
"axios": "^0.19.0",
"crypto": "^1.0.1",
"gatsby": "^2.9.2",
"gatsby-cli": "^2.7.50",
Expand Down
2 changes: 1 addition & 1 deletion postcss.config.js
Expand Up @@ -5,7 +5,7 @@ const autoprefixer = require("autoprefixer");

class TailwindExtractor {
static extract(content) {
return content.match(/[A-z0-9-:\/]+/g) || [];
return content.match(/[A-z0-9-__:\/]+/g) || [];
}
}

Expand Down
57 changes: 57 additions & 0 deletions src/components/2_molecules/DLCMenu.js
@@ -0,0 +1,57 @@
import React from "react";
import { StaticQuery, graphql, Link } from "gatsby";

const isPartiallyActive = ({ isPartiallyCurrent }) =>
isPartiallyCurrent
? {
className:
"dlc-nav__link text-BaseNavGrey hover:text-white relative active mx-4"
}
: null;

const DLCMenu = ({ data }) => {
const { dlcLinks } = data.site.siteMetadata;
return (
<>
<nav
id="main-menu"
role="menu"
className="dlc-nav bg-white"
aria-expanded="false"
>
<div className="max-w-3xl mx-auto px-4 py-4">
{dlcLinks.map(link => (
<Link
key={link.name}
to={link.link}
className="dlc-nav__link relative mx-4"
role="menuitem"
activeClassName="active"
getProps={link === "/" ? undefined : isPartiallyActive}
>
{link.name}
</Link>
))}
</div>
</nav>
</>
);
};

export default props => (
<StaticQuery
query={graphql`
query HeaderMenus {
site {
siteMetadata {
dlcLinks {
name
link
}
}
}
}
`}
render={data => <DLCMenu data={data} {...props} />}
/>
);
72 changes: 0 additions & 72 deletions src/components/2_molecules/menu.js

This file was deleted.

20 changes: 20 additions & 0 deletions src/components/2_molecules/navigation/col.js
@@ -0,0 +1,20 @@
import React from "react";

const Col = props => (
<div className="nav__wrapper">
<ul
role="menu"
className={`
sub-menu__item
sub-menu__item--reg
${props.name}-nav
`}
aria-expanded="false"
>
<h6 className="sub-menu__header">{props.header}</h6>
{props.children}
</ul>
</div>
);

export default Col;