-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Redsign/new header #5328
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
Closed
u-rogel
wants to merge
59
commits into
nodejs:major/website-redesign
from
u-rogel:redsign/new-header
Closed
Redsign/new header #5328
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
bd8a46e
feat(unit-test): introduce unit test on website redesign branch (#5178
AugustinMauroy 80039d3
chore(redesign): added new folders for new layouts and new pages
ovflowd cdbc4b4
chore(minor): just a tiny design nitpick
ovflowd df79868
chore: set up storybook (#5191) (#5214)
ecbec61
feat(ignore): add storyBook (#5229)
AugustinMauroy a2a4bd8
chore: set up testing-library jest extend (#5231)
67999b6
chore(dependencies): updated dependencies
ovflowd 48d6c91
feat: create section title component (#5237)
6ce6923
📎 chore(migration): migrate banner component (#5233)
manishprivet f9d9765
feat: migrate AnimatedPlaceholder component (#5238
HinataKah0 9311785
feat: create article alert component (#5243)
06ce22b
chore(dependencies): updated dependencies
ovflowd 386a458
fix: formatted file
ovflowd 0240b9b
chore: updated deps
ovflowd ffa9a3e
feat: migrate blockquote component (#5259)
390c2da
feat(stylelint,storybook): fixed styleling misconfig and fixed storyb…
ovflowd e121b83
feat: create article data tag component (#5280)
Olaleye-Blessing d7a154d
feat: migrate AuthorList component and add story 🎉 (#5277)
shanpriyan 620f58e
chore: lock nextjs to 13.2.0 (#5301
ovflowd 79b5134
chore(migration): migrate language selector component (#5266)
ktssr bb46dfe
feat(DarkModeToggler): Migrate and add stories to theme toggler 🎉 (#5…
shanpriyan bfcabb9
chore: updated contributing guidelines, eslint rules and storybook te…
ovflowd f6dc39f
chore: contributing quick fix of example
ovflowd 2eba819
chore: story guide and react spreading
ovflowd 86b60f3
chore: remove base styles from old styling
ovflowd 1f4530e
chore: fix storybook styles, imports, typescript config and dependenc…
ovflowd b8c76cd
chore: adopt turborepo (#5316
ovflowd 5891807
fix(package.json) Lint command is missing slashes (#5321
Harkunwar ca8b5ab
moved `DataTag` to `components/Api` (#5317)
vasanth9 c2aeeaa
hot-fix: dependency updates and fix dev runtime
ovflowd 86057dc
chore: updated start command
ovflowd 17b698f
migration(Layout): newFooter (#5320)
AugustinMauroy f989ea9
feat: migrate EditLink component (#5271)
HinataKah0 f49c166
Migrate detect os hook (#5322)
FHachez 10e535c
creating relevant files and make them compile
u-rogel fe333da
import new-header
u-rogel 154890b
feat(blog) Migrate BlogCard component (#5323)
Harkunwar bd24994
Issue#5307 - Add framer-motion to the dependency list (#5318)
JatinSharma32 763aebe
chore: add remote turbo cache and simplified gh actions cache (#5326)…
ovflowd 0488cdb
using active-localized-link
u-rogel 6ee98ea
formatting styles to match component
u-rogel f235855
add missing i18n entry
u-rogel 9907f46
cosmetics
u-rogel f5fed8d
chore: fix storybook local development mode (#5335)
d27d83a
chore: migrate pagination component (#5331)
ktssr 2738886
moving NewHeader to Sections folders
u-rogel 5b8e8c5
removed import of the new component
u-rogel 9152e1d
added useMediaQuery hook
u-rogel 5cdef23
updated snapshots file
u-rogel d4e1666
Merge branch 'major/website-redesign' into redsign/new-header
u-rogel d421b0b
Chore(node feat) (#5338)
AugustinMauroy e175feb
chore: migrate releases types (#5324)
HinataKah0 e885170
updates after review
u-rogel aa1c542
hotfix: first element no margin-top
ovflowd ac686af
added missing content from nodejs.dev
u-rogel 1cbe2f7
Merge branch 'major/website-redesign' into redsign/new-header
ovflowd 7ea2989
test: Mocked availableLocales, tests passing
u-rogel 8e8ab89
Merge branch 'major/website-redesign' of github.com:u-rogel/nodejs.or…
u-rogel b783864
Merge branch 'major/website-redesign' into redsign/new-header
u-rogel 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 |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { useRouter } from 'next/router'; | ||
import { useState, useEffect, type FC } from 'react'; | ||
import classNames from 'classnames'; | ||
import LocalizedLink from './LocalizedLink'; | ||
import type { LinkProps } from 'next/link'; | ||
import type { PropsWithChildren } from 'react'; | ||
|
||
type ActiveLocalizedLinkProps = PropsWithChildren & | ||
LinkProps & { | ||
className?: string; | ||
activeClassName: string; | ||
}; | ||
|
||
const ActiveLocalizedLink: FC<ActiveLocalizedLinkProps> = ({ | ||
children, | ||
activeClassName, | ||
className, | ||
...props | ||
}) => { | ||
const { asPath, isReady } = useRouter(); | ||
const [computedClassName, setComputedClassName] = useState(className); | ||
|
||
useEffect(() => { | ||
// Check if the router fields are updated client-side | ||
if (isReady) { | ||
// Dynamic route will be matched via props.as | ||
// Static route will be matched via props.href | ||
const linkPathName = new URL( | ||
(props.as || props.href) as string, | ||
location.href | ||
).pathname; | ||
|
||
// Using URL().pathname to get rid of query and hash | ||
const currentPathName = new URL(asPath, location.href).pathname; | ||
|
||
const newClassName = classNames(className, { | ||
activeClassName: linkPathName === currentPathName, | ||
}); | ||
|
||
if (newClassName !== computedClassName) { | ||
setComputedClassName(newClassName); | ||
} | ||
} | ||
}, [ | ||
asPath, | ||
isReady, | ||
props.as, | ||
props.href, | ||
activeClassName, | ||
className, | ||
computedClassName, | ||
]); | ||
|
||
return ( | ||
<LocalizedLink className={computedClassName} {...props}> | ||
{children} | ||
</LocalizedLink> | ||
); | ||
}; | ||
|
||
export default ActiveLocalizedLink; |
34 changes: 34 additions & 0 deletions
34
components/Api/DataTag/__tests__/__snapshots__/index.test.tsx.snap
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Data Tag component renders with blue background color when tag is 'M' 1`] = ` | ||
<div> | ||
<span | ||
class="dataTag" | ||
data-tag="M" | ||
> | ||
M | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`Data Tag component renders with red background color when tag is 'E' 1`] = ` | ||
<div> | ||
<span | ||
class="dataTag" | ||
data-tag="E" | ||
> | ||
E | ||
</span> | ||
</div> | ||
`; | ||
|
||
exports[`Data Tag component renders with yellow background color when tag is 'C' 1`] = ` | ||
<div> | ||
<span | ||
class="dataTag" | ||
data-tag="C" | ||
> | ||
C | ||
</span> | ||
</div> | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { render } from '@testing-library/react'; | ||
import DataTag from '../index'; | ||
|
||
describe('Data Tag component', () => { | ||
it(`renders with red background color when tag is 'E'`, () => { | ||
const { container } = render(<DataTag tag="E" />); | ||
|
||
expect(container).toHaveStyle('background-color: var(--danger6)'); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it(`renders with yellow background color when tag is 'C'`, () => { | ||
const { container } = render(<DataTag tag="C" />); | ||
|
||
expect(container).toHaveStyle('background-color: var(--warning4)'); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it(`renders with blue background color when tag is 'M'`, () => { | ||
const { container } = render(<DataTag tag="M" />); | ||
|
||
expect(container).toHaveStyle('background-color: var(--info6)'); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
19 changes: 19 additions & 0 deletions
19
components/Article/Alert/__tests__/__snapshots__/index.test.tsx.snap
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Alert component should render correctly 1`] = ` | ||
<div> | ||
<div | ||
class="alert" | ||
/> | ||
</div> | ||
`; | ||
|
||
exports[`Alert component should support passing children into the component 1`] = ` | ||
<div> | ||
<div | ||
class="alert" | ||
> | ||
This is an alert | ||
</div> | ||
</div> | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { render } from '@testing-library/react'; | ||
import Alert from '../index'; | ||
|
||
describe('Alert component', () => { | ||
it('should render correctly', () => { | ||
const { container } = render(<Alert />); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should support passing children into the component', () => { | ||
const { container } = render(<Alert>This is an alert</Alert>); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
53 changes: 53 additions & 0 deletions
53
components/Article/AuthorList/Author/__tests__/__snapshots__/index.test.tsx.snap
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Author component does not render without a username 1`] = ` | ||
<div> | ||
<li> | ||
<a | ||
aria-label="components.article.author.githubLinkLabel" | ||
class="link" | ||
href="https://github.com/" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<img | ||
alt="" | ||
data-nimg="1" | ||
decoding="async" | ||
height="0" | ||
loading="lazy" | ||
src="http://localhost/_next/image?url=https%3A%2F%2Fgithub.com%2F.png%3Fsize%3D0&w=16&q=75" | ||
srcset="/_next/image?url=https%3A%2F%2Fgithub.com%2F.png%3Fsize%3D0&w=16&q=75 1x" | ||
style="color: transparent; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat;" | ||
width="0" | ||
/> | ||
</a> | ||
</li> | ||
</div> | ||
`; | ||
|
||
exports[`Author component renders correctly 1`] = ` | ||
<div> | ||
<li> | ||
<a | ||
aria-label="components.article.author.githubLinkLabel" | ||
class="link" | ||
href="https://github.com/test-author" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<img | ||
alt="test-author" | ||
data-nimg="1" | ||
decoding="async" | ||
height="60" | ||
loading="lazy" | ||
src="http://localhost/_next/image?url=https%3A%2F%2Fgithub.com%2Ftest-author.png%3Fsize%3D60&w=128&q=75" | ||
srcset="/_next/image?url=https%3A%2F%2Fgithub.com%2Ftest-author.png%3Fsize%3D60&w=64&q=75 1x, /_next/image?url=https%3A%2F%2Fgithub.com%2Ftest-author.png%3Fsize%3D60&w=128&q=75 2x" | ||
style="color: transparent; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat;" | ||
width="60" | ||
/> | ||
</a> | ||
</li> | ||
</div> | ||
`; |
24 changes: 24 additions & 0 deletions
24
components/Article/AuthorList/Author/__tests__/index.test.tsx
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { render } from '@testing-library/react'; | ||
import { IntlProvider } from 'react-intl'; | ||
import Author from '..'; | ||
|
||
describe('Author component', () => { | ||
it('renders correctly', () => { | ||
const username = 'test-author'; | ||
const { container } = render( | ||
<IntlProvider locale="en" onError={() => {}}> | ||
<Author username={username} size={60} /> | ||
</IntlProvider> | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('does not render without a username', () => { | ||
const { container } = render( | ||
<IntlProvider locale="en" onError={() => {}}> | ||
<Author username="" size={0} /> | ||
</IntlProvider> | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
55 changes: 55 additions & 0 deletions
55
components/Article/AuthorList/__tests__/__snapshots__/authors-list.test.tsx.snap
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`AuthorsList component renders correctly 1`] = ` | ||
<div> | ||
<div | ||
class="authorList" | ||
> | ||
components.article.authorList.title | ||
<ul> | ||
<li> | ||
<a | ||
aria-label="components.article.author.githubLinkLabel" | ||
class="link" | ||
href="https://github.com/test-author" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<img | ||
alt="test-author" | ||
data-nimg="1" | ||
decoding="async" | ||
height="60" | ||
loading="lazy" | ||
src="http://localhost/_next/image?url=https%3A%2F%2Fgithub.com%2Ftest-author.png%3Fsize%3D60&w=128&q=75" | ||
srcset="/_next/image?url=https%3A%2F%2Fgithub.com%2Ftest-author.png%3Fsize%3D60&w=64&q=75 1x, /_next/image?url=https%3A%2F%2Fgithub.com%2Ftest-author.png%3Fsize%3D60&w=128&q=75 2x" | ||
style="color: transparent; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat;" | ||
width="60" | ||
/> | ||
</a> | ||
</li> | ||
<li> | ||
<a | ||
aria-label="components.article.author.githubLinkLabel" | ||
class="link" | ||
href="https://github.com/another-test-author" | ||
rel="noopener noreferrer" | ||
target="_blank" | ||
> | ||
<img | ||
alt="another-test-author" | ||
data-nimg="1" | ||
decoding="async" | ||
height="60" | ||
loading="lazy" | ||
src="http://localhost/_next/image?url=https%3A%2F%2Fgithub.com%2Fanother-test-author.png%3Fsize%3D60&w=128&q=75" | ||
srcset="/_next/image?url=https%3A%2F%2Fgithub.com%2Fanother-test-author.png%3Fsize%3D60&w=64&q=75 1x, /_next/image?url=https%3A%2F%2Fgithub.com%2Fanother-test-author.png%3Fsize%3D60&w=128&q=75 2x" | ||
style="color: transparent; background-size: cover; background-position: 50% 50%; background-repeat: no-repeat;" | ||
width="60" | ||
/> | ||
</a> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
`; |
15 changes: 15 additions & 0 deletions
15
components/Article/AuthorList/__tests__/authors-list.test.tsx
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { render } from '@testing-library/react'; | ||
import { IntlProvider } from 'react-intl'; | ||
import AuthorsList from '..'; | ||
|
||
describe('AuthorsList component', () => { | ||
it('renders correctly', () => { | ||
const authors = ['test-author', 'another-test-author']; | ||
const { container } = render( | ||
<IntlProvider locale="en" onError={() => {}}> | ||
<AuthorsList authors={authors} /> | ||
</IntlProvider> | ||
); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
components/Article/BlockQuote/__tests__/__snapshots__/index.test.tsx.snap
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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`BlockQuote component should render correctly 1`] = ` | ||
<div> | ||
<div | ||
class="blockQuote" | ||
/> | ||
</div> | ||
`; | ||
|
||
exports[`BlockQuote component should support passing children into the component 1`] = ` | ||
<div> | ||
<div | ||
class="blockQuote" | ||
> | ||
This is a block quote | ||
</div> | ||
</div> | ||
`; | ||
|
||
exports[`BlockQuote component should support passing multiple children into the component 1`] = ` | ||
<div> | ||
<div | ||
class="blockQuote" | ||
> | ||
<p> | ||
This is a block quote | ||
</p> | ||
<p> | ||
This is a block quote | ||
</p> | ||
</div> | ||
</div> | ||
`; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { render } from '@testing-library/react'; | ||
import BlockQuote from '../index'; | ||
|
||
describe('BlockQuote component', () => { | ||
it('should render correctly', () => { | ||
const { container } = render(<BlockQuote />); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should support passing children into the component', () => { | ||
const { container } = render( | ||
<BlockQuote>This is a block quote</BlockQuote> | ||
); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
|
||
it('should support passing multiple children into the component', () => { | ||
const { container } = render( | ||
<BlockQuote> | ||
<p>This is a block quote</p> | ||
<p>This is a block quote</p> | ||
</BlockQuote> | ||
); | ||
|
||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
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.
Uh oh!
There was an error while loading. Please reload this page.