Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit ef0b278

Browse files
style: Format all files
1 parent 756c821 commit ef0b278

12 files changed

Lines changed: 69 additions & 55 deletions

File tree

src/components/article.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ const Article = ({
3030
flexWrap: 'wrap',
3131
marginTop: '5rem',
3232
alignItems: 'center',
33-
}}>
33+
}}
34+
>
3435
Contributors:
35-
{authors && authors.map(author => (
36-
author && <AuthorLink username={author} key={author}/>
37-
))}
36+
{authors &&
37+
authors.map(
38+
author => author && <AuthorLink username={author} key={author} />
39+
)}
3840
</div>
3941
<EditLink relativePath={relativePath} />
4042
<Pagination previous={previous} next={next} />

src/components/hero.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ import React from 'react';
22

33
type Props = {
44
title: string;
5-
}
5+
};
66

77
const Hero = ({ title }: Props) => (
88
<div className="hero">
99
<h1>{title}</h1>
1010
<div className="diagonal-hero-bg">
1111
<div className="stars">
12-
<div className="small"/>
13-
<div className="medium"/>
14-
<div className="big"/>
15-
</div>
12+
<div className="small" />
13+
<div className="medium" />
14+
<div className="big" />
15+
</div>
1616
</div>
1717
</div>
18-
)
18+
);
1919

20-
export default Hero
20+
export default Hero;

src/components/navigation-item.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const NavigationItem = ({ isDone, isActive, slug, title, onClick }: Props) => {
1717
if (ref && isActive) {
1818
element.current = ref;
1919
}
20-
}
20+
};
2121

2222
useEffect(() => {
2323
if (element.current) {
@@ -34,7 +34,12 @@ const NavigationItem = ({ isDone, isActive, slug, title, onClick }: Props) => {
3434
}
3535

3636
return (
37-
<Link ref={handleRef} to={`/${slug}`} onClick={onClick} className={className}>
37+
<Link
38+
ref={handleRef}
39+
to={`/${slug}`}
40+
onClick={onClick}
41+
className={className}
42+
>
3843
{title}
3944
</Link>
4045
);

src/components/pagination.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { PaginationInfo } from '../types';
66
type Props = {
77
previous?: PaginationInfo;
88
next?: PaginationInfo;
9-
}
9+
};
1010

1111
const ulStyles: SerializedStyles = css`
1212
display: flex;
@@ -33,6 +33,6 @@ const Pagination = ({ previous, next }: Props) => (
3333
)}
3434
</li>
3535
</ul>
36-
)
36+
);
3737

38-
export default Pagination
38+
export default Pagination;

src/components/seo.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import React from 'react'
2-
import { Helmet } from 'react-helmet'
3-
import config from '../config'
1+
import React from 'react';
2+
import { Helmet } from 'react-helmet';
3+
import config from '../config';
44

55
type Props = {
6-
title?: string
7-
description?: string
8-
img?: string
9-
}
6+
title?: string;
7+
description?: string;
8+
img?: string;
9+
};
1010

1111
const SEO = ({ title, description, img }: Props) => (
1212
<Helmet
@@ -93,6 +93,6 @@ const SEO = ({ title, description, img }: Props) => (
9393
>
9494
<html lang={config.lang} />
9595
</Helmet>
96-
)
96+
);
9797

98-
export default SEO
98+
export default SEO;

src/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ module.exports = {
2020
twitterCard: `summary`,
2121
twitterImgAlt: `The Node.js Hexagon Logo`,
2222
facebook: `https://www.facebook.com/nodejsfoundation/`,
23-
}
23+
};

src/pages/404.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ export default (props: Props) => {
1414
return (
1515
<Layout title={title} description={description}>
1616
<Hero title={title} />
17-
<article style={{width: '100%'}} className="article-reader">
18-
<p>
19-
The page you're trying to access does not exist. Go back to the
20-
Homepage or find what you're looking for in the menu.
21-
</p>
22-
<p>
23-
Take me back to the <a href="/">Homepage</a>
24-
</p>
17+
<article style={{ width: '100%' }} className="article-reader">
18+
<p>
19+
The page you're trying to access does not exist. Go back to the
20+
Homepage or find what you're looking for in the menu.
21+
</p>
22+
<p>
23+
Take me back to the <a href="/">Homepage</a>
24+
</p>
2525
</article>
2626
</Layout>
2727
);

src/util/scrollTo.tsx

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
const easeInOutCubic = (t: number, b: number, c: number, d: number) => (t /= d / 2) < 1 ? c / 2 * t * t * t + b : c / 2 * ((t -= 2) * t * t + 2) + b;
1+
const easeInOutCubic = (t: number, b: number, c: number, d: number) =>
2+
(t /= d / 2) < 1
3+
? (c / 2) * t * t * t + b
4+
: (c / 2) * ((t -= 2) * t * t + 2) + b;
25

3-
export function scrollTo(scrollTo: number, duration: number = 333): Promise<boolean> {
4-
const start = (window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0);
6+
export function scrollTo(
7+
scrollTo: number,
8+
duration: number = 333
9+
): Promise<boolean> {
10+
const start =
11+
(window.pageYOffset || document.documentElement.scrollTop) -
12+
(document.documentElement.clientTop || 0);
513
const change = scrollTo - start;
614
let previousTime = window.performance.now();
715
let currentTime = 0;
@@ -12,7 +20,10 @@ export function scrollTo(scrollTo: number, duration: number = 333): Promise<bool
1220
const increment = time - previousTime;
1321
previousTime = time;
1422
currentTime += increment;
15-
(document.scrollingElement || window).scrollTo(0, easeInOutCubic(currentTime, start, change, duration));
23+
(document.scrollingElement || window).scrollTo(
24+
0,
25+
easeInOutCubic(currentTime, start, change, duration)
26+
);
1627

1728
if (currentTime < duration) {
1829
return window.requestAnimationFrame(animateScroll);
@@ -23,4 +34,4 @@ export function scrollTo(scrollTo: number, duration: number = 333): Promise<bool
2334
});
2435

2536
return ret;
26-
};
37+
}

test/components/author-link.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ import AuthorLink from '../../src/components/author-link';
55
describe('AuthorLink component', () => {
66
it('renders correctly', () => {
77
const username = 'test-author';
8-
const tree = renderer.create(<AuthorLink key={username} username={username} />).toJSON();
8+
const tree = renderer
9+
.create(<AuthorLink key={username} username={username} />)
10+
.toJSON();
911
expect(tree).toMatchSnapshot();
1012
});
1113
it('does not render without a username', () => {

test/components/header.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react'
2-
import renderer from 'react-test-renderer'
3-
import Header from '../../src/components/header'
1+
import React from 'react';
2+
import renderer from 'react-test-renderer';
3+
import Header from '../../src/components/header';
44

55
describe('Tests for Header component', () => {
66
it('renders correctly', () => {
7-
const tree = renderer.create(<Header />).toJSON()
8-
expect(tree).toMatchSnapshot()
9-
})
10-
})
7+
const tree = renderer.create(<Header />).toJSON();
8+
expect(tree).toMatchSnapshot();
9+
});
10+
});

0 commit comments

Comments
 (0)