From efade11ee2713f5634dce8d0cdc6d7ebd91e199d Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Fri, 12 Jun 2020 14:38:56 -0400 Subject: [PATCH 1/3] consent manager bugfix, 404 page improvement --- website/package-lock.json | 20 ++++++------- website/package.json | 2 +- website/pages/404.jsx | 34 ++-------------------- website/pages/not-found/index.jsx | 33 ++++++++++++++++++++++ website/pages/not-found/style.module.css | 36 ++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 43 deletions(-) create mode 100644 website/pages/not-found/index.jsx create mode 100644 website/pages/not-found/style.module.css diff --git a/website/package-lock.json b/website/package-lock.json index 70c4d752c..5045bb15f 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -1344,13 +1344,13 @@ "integrity": "sha512-/Mgw6ufzjsysw5U0v7c0tCXMQeE4BSbGeasDaTuh1r6jQ+2Cokl1XhPqKqXn4+xkcx3CIVdyoUYOSLmgzutn3Q==" }, "@hashicorp/nextjs-scripts": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/@hashicorp/nextjs-scripts/-/nextjs-scripts-10.0.1.tgz", - "integrity": "sha512-IwKr0HQvt6NZoJ9SlTBXqgDHYi4ticfcLM3mH3WH8b0Mr2B+Y5I/VzOOHiLxVcWmJmOECuV9EY+TaxlE5h2YQQ==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@hashicorp/nextjs-scripts/-/nextjs-scripts-10.0.2.tgz", + "integrity": "sha512-s18LHSyrWcgNbsFEnyMLUa7jaLBz2/UXu984UrxVoapHTq5eL4HEk1dJZ3yHcRCJjG7TEYvaXzgkL4IHc1UR5w==", "requires": { "@bugsnag/js": "7.1.1", "@bugsnag/plugin-react": "7.1.1", - "@hashicorp/react-consent-manager": "2.1.1", + "@hashicorp/react-consent-manager": "2.1.2", "@hashicorp/react-enterprise-alert": "^2.1.0", "@hashicorp/react-tabs": "^0.4.0", "@hashicorp/remark-plugins": "3.0.0", @@ -1436,9 +1436,9 @@ } }, "@hashicorp/react-consent-manager": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@hashicorp/react-consent-manager/-/react-consent-manager-2.1.1.tgz", - "integrity": "sha512-tIVR3LhDnwcHAxa+lrfrjJmthynCzpVrn9MYHcqKBVrCozV3SCC9zeRjPSlvxU9/GfAYAefull2hH/kg/duyOw==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/@hashicorp/react-consent-manager/-/react-consent-manager-2.1.2.tgz", + "integrity": "sha512-AjCFIEZPa6K9UFr3Nvjy8cLHuGDa2qpQat/QVFHKp0t/acflC8z7xIDh8Yo9RBCp+YF+gF+g50ll/hhzX0pEeQ==", "requires": { "@hashicorp/react-button": "^2.2.0", "@hashicorp/react-toggle": "^1.0.1", @@ -8814,9 +8814,9 @@ "integrity": "sha512-8hfl5RD6P7rEeIbzStBz3h4f+BQHfq/ABtoU6gXKQv5OcZhnmrIpG7e1pYaZ8hS9e0mp+bxUj08fnDUbKctYyA==" }, "jsx-ast-utils": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.3.0.tgz", - "integrity": "sha512-3HNoc7nZ1hpZIKB3hJ7BlFRkzCx2BynRtfSwbkqZdpRdvAPsGMnzclPwrvDBS7/lalHTj21NwIeaEpysHBOudg==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz", + "integrity": "sha512-z1xSldJ6imESSzOjd3NNkieVJKRlKYSOtMG8SFyCj2FIrvSaSuli/WjpBkEzCBoR9bYYYFgqJw61Xhu7Lcgk+w==", "requires": { "array-includes": "^3.1.1", "object.assign": "^4.1.0" diff --git a/website/package.json b/website/package.json index 99dfb2b2e..588cbdcbc 100644 --- a/website/package.json +++ b/website/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "author": "HashiCorp", "dependencies": { - "@hashicorp/nextjs-scripts": "^10.0.1", + "@hashicorp/nextjs-scripts": "^10.0.2", "@hashicorp/react-button": "^2.2.0", "@hashicorp/react-code-block": "^1.2.7", "@hashicorp/react-content": "3.0.0-0", diff --git a/website/pages/404.jsx b/website/pages/404.jsx index 7e4b985cf..66f42b934 100644 --- a/website/pages/404.jsx +++ b/website/pages/404.jsx @@ -1,32 +1,2 @@ -import Link from 'next/link' -import { useEffect } from 'react' - -export default function NotFound() { - useEffect(() => { - if ( - typeof window !== 'undefined' && - typeof window?.analytics?.track === 'function' && - typeof window?.document?.referrer === 'string' && - typeof window?.location?.href === 'string' - ) - window.analytics.track(window.location.href, { - category: '404 Response', - label: window.document.referrer || 'No Referrer', - }) - }, []) - - return ( -
-

Page Not Found

-

- We‘re sorry but we can‘t find the page you‘re looking - for. -

-

- - Back to Home - -

-
- ) -} +import NotFound from './not-found' +export default NotFound diff --git a/website/pages/not-found/index.jsx b/website/pages/not-found/index.jsx new file mode 100644 index 000000000..92933a397 --- /dev/null +++ b/website/pages/not-found/index.jsx @@ -0,0 +1,33 @@ +import s from './style.module.css' +import Link from 'next/link' +import { useEffect } from 'react' + +export default function NotFound() { + useEffect(() => { + if ( + typeof window !== 'undefined' && + typeof window?.analytics?.track === 'function' && + typeof window?.document?.referrer === 'string' && + typeof window?.location?.href === 'string' + ) + window.analytics.track(window.location.href, { + category: '404 Response', + label: window.document.referrer || 'No Referrer', + }) + }, []) + + return ( +
+

Page Not Found

+

+ We‘re sorry but we can‘t find the page you‘re looking + for. +

+

+ + Back to Home + +

+
+ ) +} diff --git a/website/pages/not-found/style.module.css b/website/pages/not-found/style.module.css new file mode 100644 index 000000000..3a5dfec90 --- /dev/null +++ b/website/pages/not-found/style.module.css @@ -0,0 +1,36 @@ +.root { + composes: .g-grid-container from global; + display: flex; + flex-direction: column; + justify-content: center; + margin: 64px auto; /* this is being overridden at the request of the learn team */ + max-width: 784px; + min-height: 50vh; + padding-inline: 32px; + text-align: center; + + @media (--large) { + padding-inline: 24px; + } + + & h1 { + font-size: 1.5rem; + letter-spacing: -0.004em; + line-height: 1.375em; + + @media (--medium-up) { + font-size: 1.75rem; + line-height: 1.321em; + } + + @media (--large) { + font-size: 2rem; + letter-spacing: -0.006em; + line-height: 1.313em; + } + } + + & a { + color: var(--highlight-color); + } +} From a65a6e692a48060dd174a1c8a6dc027a0f9f561e Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Fri, 12 Jun 2020 14:53:54 -0400 Subject: [PATCH 2/3] adjust environment variables --- website/netlify.toml | 2 +- website/next.config.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/website/netlify.toml b/website/netlify.toml index 52eb75214..8abee246b 100644 --- a/website/netlify.toml +++ b/website/netlify.toml @@ -7,7 +7,7 @@ command = "npm run static" [context.production] - environment = { HASHI_ENV = "production", NODE_ENV = "production"} + environment = { HASHI_ENV = "production" } [context.deploy-preview] environment = { HASHI_ENV = "staging" } diff --git a/website/next.config.js b/website/next.config.js index 8c0b4ce07..68a8ec383 100644 --- a/website/next.config.js +++ b/website/next.config.js @@ -1,5 +1,7 @@ const withHashicorp = require('@hashicorp/nextjs-scripts') +console.log(`Environment: ${process.env.HASHI_ENV}`) + module.exports = withHashicorp({ defaultLayout: true, transpileModules: ['is-absolute-url', '@hashicorp/react-mega-nav'], From c141d4ed9e7133502419aabe488e44e69d433446 Mon Sep 17 00:00:00 2001 From: Jeff Escalante Date: Fri, 12 Jun 2020 15:23:44 -0400 Subject: [PATCH 3/3] drop unused font --- website/pages/_app.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/website/pages/_app.js b/website/pages/_app.js index 6e2aa16f1..59a88576e 100644 --- a/website/pages/_app.js +++ b/website/pages/_app.js @@ -30,12 +30,6 @@ function App({ Component, pageProps }) { description="Vagrant enables users to create and configure lightweight, reproducible, and portable development environments." image="https://www.vagrantup.com/img/og-image.png" - stylesheet={[ - { - href: - 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700&display=swap', - }, - ]} icon={[{ href: '/favicon.ico' }]} preload={[ { href: '/fonts/klavika/medium.woff2', as: 'font' },