This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1k
Homepage: Changes hardcoded data version and download urls #665
Merged
benhalverson
merged 8 commits into
nodejs:staging
from
giankotarola:fix-hardcoded-version
May 3, 2020
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4c787ee
fix(hero.tsx): Removed hardcoded version and use useReleaseHistory
giankotarola cdc8228
Merge remote-tracking branch 'upstream/staging' into fix-hardcoded-ve…
giankotarola e8ea280
Merge remote-tracking branch 'upstream/staging' into fix-hardcoded-ve…
giankotarola 51e039d
fix(hero.tsx): Get last change from staging and fix hooks path
giankotarola 38920b3
fix(hero.tsx): Update hero.tsx snap
giankotarola d3cbdcc
fix(hero.tsx): Remove whats new link and fix lts/current download urls
giankotarola 3c05e00
Merge remote-tracking branch 'upstream/staging' into fix-hardcoded-ve…
giankotarola 86994dd
fix(doc.tsx): Fix lint with npm run lint -- --fix
giankotarola 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
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,34 +1,83 @@ | ||
| import React from 'react'; | ||
| import { Link } from 'gatsby'; | ||
|
|
||
| import { detectOS, UserOS } from '../../util/detectOS'; | ||
| import { useReleaseHistory, ReleaseData } from '../../hooks/useReleaseHistory'; | ||
|
|
||
| interface Props { | ||
| title: string; | ||
| subTitle: string; | ||
| } | ||
|
|
||
| const NodeVersion = 'Version 10.15.3'; | ||
|
|
||
| const Hero = ({ title, subTitle }: Props): JSX.Element => ( | ||
| <div className="home-page-hero"> | ||
| <h1>{title}</h1> | ||
| <h2 className="sub-title t-subheading">{subTitle}</h2> | ||
| <div className="btn-ctas"> | ||
| <div className="download-lts-container"> | ||
| <button className="download-lts-cta t-body1" type="button"> | ||
| Download Node (LTS) | ||
| </button> | ||
| <p className="links t-caption"> | ||
| {NodeVersion} - <Link to="/download">What’s new</Link> /{' '} | ||
| <Link to="/download">Get Current</Link> | ||
| </p> | ||
| function downloadUrlByOS(userOS: UserOS, version: string): string { | ||
| const baseURL = `https://nodejs.org/dist/${version}`; | ||
|
|
||
| if (userOS === UserOS.MOBILE) { | ||
| return baseURL; | ||
| } | ||
|
|
||
| if (userOS === UserOS.MAC) { | ||
| return `${baseURL}/node-${version}.pkg`; | ||
| } | ||
|
|
||
| if (userOS === UserOS.WIN) { | ||
| if ( | ||
| navigator.appVersion.indexOf('WOW64') !== -1 || | ||
benhalverson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| navigator.appVersion.indexOf('Win64') !== -1 | ||
| ) { | ||
| return `${baseURL}/node-${version}-x64.msi`; | ||
| } | ||
|
|
||
| return `${baseURL}/node-${version}-x86.msi`; | ||
| } | ||
|
|
||
| return `${baseURL}/node-${version}.tar.gz`; | ||
| } | ||
|
|
||
| const Hero = ({ title, subTitle }: Props): JSX.Element => { | ||
| const userOS = detectOS(); | ||
| const [currentRelease, ...releases] = useReleaseHistory(); | ||
|
|
||
| // find first lts version (first found is last LTS) | ||
| const lastLTSRelease = releases.find( | ||
| (release: ReleaseData): boolean => release.lts | ||
| ); | ||
|
|
||
| const ltsVersionUrl = downloadUrlByOS( | ||
| userOS, | ||
| lastLTSRelease ? lastLTSRelease.version : '' | ||
| ); | ||
| const currentVersionUrl = downloadUrlByOS( | ||
| userOS, | ||
| currentRelease ? currentRelease.version : '' | ||
| ); | ||
|
|
||
| return ( | ||
| <div className="home-page-hero"> | ||
| <h1>{title}</h1> | ||
| <h2 className="sub-title t-subheading">{subTitle}</h2> | ||
| <div className="btn-ctas"> | ||
| <div className="download-lts-container"> | ||
| <a href={ltsVersionUrl}> | ||
| <button className="download-lts-cta t-body1" type="button"> | ||
| Download Node (LTS) | ||
| </button> | ||
| </a> | ||
| <p className="links t-caption"> | ||
| {lastLTSRelease | ||
| ? `Version ${lastLTSRelease.version.substr(1)} - ` | ||
| : ''} | ||
| <a href={currentVersionUrl}>Get Current</a> | ||
| </p> | ||
| </div> | ||
| <Link to="/learn"> | ||
| <button className="learn-cta t-body1" type="button"> | ||
| Learn Node | ||
| </button> | ||
| </Link> | ||
| </div> | ||
| <Link to="/learn"> | ||
| <button className="learn-cta t-body1" type="button"> | ||
| Learn Node | ||
| </button> | ||
| </Link> | ||
| </div> | ||
| </div> | ||
| ); | ||
| ); | ||
| }; | ||
|
|
||
| export default Hero; | ||
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
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
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
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
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.
Buttons shouldn't be nested inside links https://stackoverflow.com/questions/6393827/can-i-nest-a-button-element-inside-an-a-using-html5
Uh oh!
There was an error while loading. Please reload this page.
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.
ooh yeaa 😕!
I tried it with:
But styles change:
Also fixing
Learn Nodebutton too with:And styles are not the same too 😕
Looking into CSS to could send a PR with the fix for it.
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.
https://github.com/nodejs/nodejs.dev/pull/655/files#diff-a3053da7eac1859c5b6641368591672dR12-R24 for some inspiration
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.
Thanks @benhalverson! Just a quick question, in this link https://www.figma.com/proto/lOxAGGg5KXb6nwie7zXkz6/NJ---Design-System?scaling=min-zoom&node-id=1338%3A13127, is possible to could see design details as font sizes, color, size, etc?
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.
Yes click on the figma icon in the top left and signup / signin
You can then see the artboard with those details. The colors fonts and size are already in tokens.scss
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.
@nschonni @benhalverson I have sent a fix in #675