Upgrade Downloads Page (#10907)

* upgrade downloads page

** For the stable website changes to ncloud docs on master were removed
as it contained documentation for an unreleased feature.
This commit is contained in:
Jeff Escalante 2021-04-14 14:51:29 -04:00 committed by Wilken Rivera
parent 4586c4c575
commit 1b20d9617f
10 changed files with 29554 additions and 4630 deletions

2
website/next-env.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />

34034
website/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -6,27 +6,28 @@
"dependencies": {
"@hashicorp/mktg-global-styles": "3.0.1",
"@hashicorp/mktg-logos": "1.0.2",
"@hashicorp/nextjs-scripts": "17.1.0",
"@hashicorp/nextjs-scripts": "18.0.0",
"@hashicorp/react-button": "5.0.0",
"@hashicorp/react-docs-page": "13.0.3",
"@hashicorp/react-docs-page": "13.1.3",
"@hashicorp/react-hashi-stack-menu": "2.0.0",
"@hashicorp/react-head": "2.0.0",
"@hashicorp/react-head": "3.0.1",
"@hashicorp/react-inline-svg": "6.0.0",
"@hashicorp/react-markdown-page": "1.0.0",
"@hashicorp/react-product-downloader": "4.0.2",
"@hashicorp/react-markdown-page": "1.1.1",
"@hashicorp/react-product-downloads-page": "^1.0.2",
"@hashicorp/react-search": "5.0.1",
"@hashicorp/react-section-header": "5.0.0",
"@hashicorp/react-subnav": "8.0.0",
"@hashicorp/react-vertical-text-block-list": "5.0.0",
"adm-zip": "^0.5.4",
"@hashicorp/react-vertical-text-block-list": "6.0.0",
"adm-zip": "^0.5.5",
"gray-matter": "^4.0.2",
"next": "10.0.6",
"next-mdx-remote": "^1.0.1",
"next-remote-watch": "0.3.0",
"next": "10.1.3",
"next-mdx-remote": "^2.1.4",
"next-remote-watch": "1.0.0",
"react": "16.13.1",
"react-dom": "16.13.1"
},
"devDependencies": {
"@types/react": "^17.0.3",
"dart-linkcheck": "2.0.15",
"husky": "4.3.5",
"prettier": "2.2.1"

View File

@ -5,7 +5,9 @@ export default class MyDocument extends Document {
render() {
return (
<Html>
<HashiHead is={Head} />
<Head>
<HashiHead />
</Head>
<body>
<Main />
<NextScript />

View File

@ -0,0 +1 @@
<svg width="230" height="88" viewBox="0 0 230 88" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M75.84 23.69h15.73c9.31 0 12.76 3.81 12.76 10.89v5.5c0 7-3.75 10.83-13.13 10.83h-7.74V64h-7.62V23.69zm15.3 6.72h-7.68V44.2h7.68c4.3 0 5.57-1.58 5.57-4.9v-4.11c0-3.33-1.41-4.78-5.57-4.78zM130.09 64h-6l-.54-2a16.153 16.153 0 01-8.77 2.6c-5.39 0-7.68-3.69-7.68-8.77 0-6 2.6-8.29 8.58-8.29h7.08v-3.1c0-3.27-.91-4.42-5.62-4.42a41.477 41.477 0 00-8.17.91l-.91-5.62a38.372 38.372 0 0110.1-1.39c9.26 0 12 3.26 12 10.64L130.09 64zm-7.38-11.12h-5.41c-2.42 0-3.09.66-3.09 2.9 0 2 .67 3 3 3a11.571 11.571 0 005.56-1.51l-.06-4.39zm11.79.39v-8c0-7.93 3.45-11.31 12.7-11.31 2.437.003 4.862.353 7.2 1.04l-.91 6c-2-.492-4.05-.754-6.11-.78-4.23 0-5.5 1.27-5.5 4.9v8.16c0 3.63 1.27 4.9 5.5 4.9a24.58 24.58 0 006.11-.79l.91 6a24.117 24.117 0 01-7.2 1.09c-9.25.1-12.7-3.29-12.7-11.21zM159.061 64V22.49l7.37-1V64h-7.37zm25-29.45l-8.61 14.55 9 14.87h-8.11l-8.88-14.87 8.41-14.58 8.19.03zm15.389 23.98a30.714 30.714 0 009-1.39l1.15 5.56a31.558 31.558 0 01-10.82 1.88c-9.26 0-12.46-4.3-12.46-11.37v-7.8c0-6.23 2.78-11.49 12.22-11.49 9.44 0 11.55 5.5 11.55 11.85v6.29h-16.38v1.51c0 3.57 1.27 4.96 5.74 4.96zm-5.74-12.4h9.37v-1.45c0-2.78-.84-4.72-4.47-4.72s-4.9 1.94-4.9 4.72v1.45zm36.101-5.44a58.126 58.126 0 00-7.8 4.29V64h-7.38V34.52h6.23l.48 3.27a32.936 32.936 0 017.75-3.87l.72 6.77z" fill="#000"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M0 16.27l22.69 13.11v48.34L0 64.61V16.27z" fill="#02A8EF"></path><path d="M33.92 21.92L9.3 7.72v9.86l16.77 9.68v29.6l7.89 4.53c4.89 2.82 8.88 1.13 8.88-3.75V35.92c-.04-4.92-4.03-11.18-8.92-14z" fill="#02A8EF"></path></svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,34 +1,53 @@
import VERSION from 'data/version.js'
import ProductDownloader from '@hashicorp/react-product-downloader'
import Head from 'next/head'
import HashiHead from '@hashicorp/react-head'
import VERSION from 'data/version'
import { productSlug } from 'data/metadata'
import ProductDownloadsPage from '@hashicorp/react-product-downloads-page'
import { generateStaticProps } from '@hashicorp/react-product-downloads-page/server'
import s from './style.module.css'
export default function DownloadsPage({ releaseData }) {
export default function DownloadsPage(staticProps) {
return (
<div id="p-downloads" className="g-container">
<HashiHead is={Head} title="Downloads | Packer by HashiCorp" />
<ProductDownloader
product="Packer"
version={VERSION}
releaseData={releaseData}
/>
</div>
<ProductDownloadsPage
getStartedDescription="Follow step-by-step tutorials on the essentials of Nomad."
getStartedLinks={[
{
label: 'Getting Started',
href:
'https://learn.hashicorp.com/collections/packer/getting-started',
},
{
label: 'Build an Image with Packer',
href:
'https://learn.hashicorp.com/tutorials/packer/getting-started-build-image',
},
{
label: 'Provisioning',
href:
'https://learn.hashicorp.com/tutorials/packer/getting-started-provision',
},
{
label: 'View all Packer tutorials',
href: 'https://learn.hashicorp.com/packer',
},
]}
logo={
<img
className={s.logo}
alt="Packer"
src={require('./img/packer-logo.svg')}
/>
}
tutorialLink={{
href: 'https://learn.hashicorp.com/packer',
label: 'View Tutorials at HashiCorp Learn',
}}
{...staticProps}
/>
)
}
export async function getStaticProps() {
return fetch(`https://releases.hashicorp.com/packer/${VERSION}/index.json`)
.then((res) => res.json())
.then((releaseData) => ({ props: { releaseData } }))
.catch(() => {
throw new Error(
`--------------------------------------------------------
Unable to resolve version ${VERSION} on releases.hashicorp.com from link
<https://releases.hashicorp.com/packer/${VERSION}/index.json>. Usually this
means that the specified version has not yet been released. The downloads page
version can only be updated after the new version has been released, to ensure
that it works for all users.
----------------------------------------------------------`
)
})
return generateStaticProps({
product: productSlug,
latestVersion: VERSION,
})
}

View File

@ -1,18 +0,0 @@
#p-downloads {
/** DEBT: short-term color override until we upgrade to the most recent product downloader.
This will be handled as part of the "Redesigned Downloads Pages" project:
https://app.asana.com/0/1179659922742997/1199639822462636 */
--brand: var(--packer);
color: black !important;
margin-top: 72px;
margin-bottom: 72px;
& .g-type-buttons-and-standalone-links {
color: black;
}
& .g-product-downloader.product-packer {
--highlight-color: var(--packer-link);
}
}

View File

@ -0,0 +1,9 @@
.root {
composes: .g-container from global;
margin-top: 72px;
margin-bottom: 72px;
}
.logo {
width: 105px;
}

View File

@ -12,7 +12,6 @@
@import '~@hashicorp/react-consent-manager/style.css';
@import '~@hashicorp/react-content/style.css';
@import '~@hashicorp/react-docs-page/style.css';
@import '~@hashicorp/react-product-downloader/dist/style.css';
@import '~@hashicorp/react-search/style.css';
@import '~@hashicorp/react-subnav/style.css';
@import '~@hashicorp/react-tabs/style.css';
@ -25,7 +24,6 @@
/* Local Pages */
@import './home/style.css';
@import './downloads/style.css';
@import './community/style.css';
/* Print Styles */

20
website/tsconfig.json Normal file
View File

@ -0,0 +1,20 @@
{
"compilerOptions": {
"allowJs": true,
"baseUrl": ".",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"isolatedModules": true,
"jsx": "preserve",
"lib": ["dom", "dom.iterable", "esnext"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": false,
"target": "es5"
},
"exclude": ["node_modules"],
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"]
}