Skip to content

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
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
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 Mar 23, 2023
80039d3
chore(redesign): added new folders for new layouts and new pages
ovflowd Mar 27, 2023
cdbc4b4
chore(minor): just a tiny design nitpick
ovflowd Mar 27, 2023
df79868
chore: set up storybook (#5191) (#5214)
Apr 1, 2023
ecbec61
feat(ignore): add storyBook (#5229)
AugustinMauroy Apr 5, 2023
a2a4bd8
chore: set up testing-library jest extend (#5231)
Apr 6, 2023
67999b6
chore(dependencies): updated dependencies
ovflowd Apr 7, 2023
48d6c91
feat: create section title component (#5237)
Apr 8, 2023
6ce6923
📎 chore(migration): migrate banner component (#5233)
manishprivet Apr 11, 2023
f9d9765
feat: migrate AnimatedPlaceholder component (#5238
HinataKah0 Apr 11, 2023
9311785
feat: create article alert component (#5243)
Apr 11, 2023
06ce22b
chore(dependencies): updated dependencies
ovflowd Apr 12, 2023
386a458
fix: formatted file
ovflowd Apr 15, 2023
0240b9b
chore: updated deps
ovflowd Apr 15, 2023
ffa9a3e
feat: migrate blockquote component (#5259)
Apr 15, 2023
390c2da
feat(stylelint,storybook): fixed styleling misconfig and fixed storyb…
ovflowd Apr 18, 2023
e121b83
feat: create article data tag component (#5280)
Olaleye-Blessing Apr 18, 2023
d7a154d
feat: migrate AuthorList component and add story 🎉 (#5277)
shanpriyan Apr 19, 2023
620f58e
chore: lock nextjs to 13.2.0 (#5301
ovflowd Apr 19, 2023
79b5134
chore(migration): migrate language selector component (#5266)
ktssr Apr 20, 2023
bb46dfe
feat(DarkModeToggler): Migrate and add stories to theme toggler 🎉 (#5…
shanpriyan Apr 20, 2023
bfcabb9
chore: updated contributing guidelines, eslint rules and storybook te…
ovflowd Apr 20, 2023
f6dc39f
chore: contributing quick fix of example
ovflowd Apr 20, 2023
2eba819
chore: story guide and react spreading
ovflowd Apr 20, 2023
86b60f3
chore: remove base styles from old styling
ovflowd Apr 20, 2023
1f4530e
chore: fix storybook styles, imports, typescript config and dependenc…
ovflowd Apr 21, 2023
b8c76cd
chore: adopt turborepo (#5316
ovflowd Apr 21, 2023
5891807
fix(package.json) Lint command is missing slashes (#5321
Harkunwar Apr 21, 2023
ca8b5ab
moved `DataTag` to `components/Api` (#5317)
vasanth9 Apr 21, 2023
c2aeeaa
hot-fix: dependency updates and fix dev runtime
ovflowd Apr 24, 2023
86057dc
chore: updated start command
ovflowd Apr 24, 2023
17b698f
migration(Layout): newFooter (#5320)
AugustinMauroy Apr 24, 2023
f989ea9
feat: migrate EditLink component (#5271)
HinataKah0 Apr 24, 2023
f49c166
Migrate detect os hook (#5322)
FHachez Apr 24, 2023
10e535c
creating relevant files and make them compile
u-rogel Apr 24, 2023
fe333da
import new-header
u-rogel Apr 24, 2023
154890b
feat(blog) Migrate BlogCard component (#5323)
Harkunwar Apr 25, 2023
bd24994
Issue#5307 - Add framer-motion to the dependency list (#5318)
JatinSharma32 Apr 24, 2023
763aebe
chore: add remote turbo cache and simplified gh actions cache (#5326)…
ovflowd Apr 26, 2023
0488cdb
using active-localized-link
u-rogel Apr 27, 2023
6ee98ea
formatting styles to match component
u-rogel Apr 27, 2023
f235855
add missing i18n entry
u-rogel Apr 27, 2023
9907f46
cosmetics
u-rogel Apr 27, 2023
f5fed8d
chore: fix storybook local development mode (#5335)
Apr 27, 2023
d27d83a
chore: migrate pagination component (#5331)
ktssr Apr 28, 2023
2738886
moving NewHeader to Sections folders
u-rogel Apr 28, 2023
5b8e8c5
removed import of the new component
u-rogel Apr 28, 2023
9152e1d
added useMediaQuery hook
u-rogel Apr 28, 2023
5cdef23
updated snapshots file
u-rogel Apr 28, 2023
d4e1666
Merge branch 'major/website-redesign' into redsign/new-header
u-rogel Apr 29, 2023
d421b0b
Chore(node feat) (#5338)
AugustinMauroy Apr 30, 2023
e175feb
chore: migrate releases types (#5324)
HinataKah0 May 1, 2023
e885170
updates after review
u-rogel May 2, 2023
aa1c542
hotfix: first element no margin-top
ovflowd May 2, 2023
ac686af
added missing content from nodejs.dev
u-rogel May 2, 2023
1cbe2f7
Merge branch 'major/website-redesign' into redsign/new-header
ovflowd May 2, 2023
7ea2989
test: Mocked availableLocales, tests passing
u-rogel May 7, 2023
8e8ab89
Merge branch 'major/website-redesign' of github.com:u-rogel/nodejs.or…
u-rogel May 8, 2023
b783864
Merge branch 'major/website-redesign' into redsign/new-header
u-rogel May 8, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions components/ActiveLocalizedLink.tsx
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 components/Api/DataTag/__tests__/__snapshots__/index.test.tsx.snap
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>
`;
25 changes: 25 additions & 0 deletions components/Api/DataTag/__tests__/index.test.tsx
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();
});
});
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>
`;
16 changes: 16 additions & 0 deletions components/Article/Alert/__tests__/index.test.tsx
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();
});
});
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 components/Article/AuthorList/Author/__tests__/index.test.tsx
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();
});
});
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 components/Article/AuthorList/__tests__/authors-list.test.tsx
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();
});
});
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>
`;
29 changes: 29 additions & 0 deletions components/Article/BlockQuote/__tests__/index.test.tsx
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();
});
});
Loading