Skip to content

Commit 7054ac9

Browse files
authored
added format and linting to frontend (#18)
1 parent 7ca5d92 commit 7054ac9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1225
-1146
lines changed
+13-13
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import { Metadata } from "next"
2-
import { getPostData } from "../lib/utilities/posts"
1+
import { Metadata } from "next";
2+
import { getPostData } from "../lib/utilities/posts";
33

44
type Post = {
5-
id: string
6-
content: string
7-
title: string
8-
description: string
9-
author: string
10-
publishedAt: string
11-
}
5+
id: string;
6+
content: string;
7+
title: string;
8+
description: string;
9+
author: string;
10+
publishedAt: string;
11+
};
1212

13-
const aboutPath = "app/content/"
13+
const aboutPath = "app/content/";
1414

1515
export const metadata: Metadata = {
1616
title: "Getting started with a base project",
17-
}
17+
};
1818

1919
export default async function About() {
20-
const data: Post = await getPostData("about", aboutPath)
20+
const data: Post = await getPostData("about", aboutPath);
2121

2222
return (
2323
<>
2424
<div className="max-w-none mx-auto sm:w-3/5 prose prose-reader-light prose-reader-base prose-reader-compact px-4 pt-10 pb-20 sm:px-6">
2525
<div dangerouslySetInnerHTML={{ __html: data.content }} />
2626
</div>
2727
</>
28-
)
28+
);
2929
}
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
import { Metadata } from "next"
2-
import { getPostData } from "../lib/utilities/posts"
1+
import { Metadata } from "next";
2+
import { getPostData } from "../lib/utilities/posts";
33

44
type Post = {
5-
id: string
6-
content: string
7-
title: string
8-
description: string
9-
author: string
10-
publishedAt: string
11-
}
5+
id: string;
6+
content: string;
7+
title: string;
8+
description: string;
9+
author: string;
10+
publishedAt: string;
11+
};
1212

13-
const aboutPath = "app/content/"
13+
const aboutPath = "app/content/";
1414

1515
export const metadata: Metadata = {
1616
title: "Authentication with Magic and Oauth2",
17-
}
17+
};
1818

1919
export default async function Authentication() {
20-
const data: Post = await getPostData("authentication", aboutPath)
20+
const data: Post = await getPostData("authentication", aboutPath);
2121

2222
return (
2323
<>
2424
<div className="max-w-none mx-auto sm:w-3/5 prose prose-reader-light prose-reader-base prose-reader-compact px-4 pt-10 pb-20 sm:px-6">
2525
<div dangerouslySetInnerHTML={{ __html: data.content }} />
2626
</div>
2727
</>
28-
)
28+
);
2929
}
+15-15
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,32 @@
1-
import { getPostData } from "../../lib/utilities/posts"
2-
import { readableDate } from "../../lib/utilities/textual"
1+
import { getPostData } from "../../lib/utilities/posts";
2+
import { readableDate } from "../../lib/utilities/textual";
33

44
type Params = {
5-
id: string
6-
}
5+
id: string;
6+
};
77

88
type Props = {
9-
params: Params
10-
}
9+
params: Params;
10+
};
1111

1212
type Post = {
13-
title: string
14-
publishedAt: string
15-
content: string
16-
author: string
17-
}
13+
title: string;
14+
publishedAt: string;
15+
content: string;
16+
author: string;
17+
};
1818

1919
export async function generateMetadata({ params }: Props) {
20-
const postData: Post = await getPostData(params.id)
20+
const postData: Post = await getPostData(params.id);
2121

2222
return {
2323
title: postData.title,
24-
}
24+
};
2525
}
2626

2727
// -< Post >-
2828
export default async function Post({ params }: Props) {
29-
const data: Post = await getPostData(params.id)
29+
const data: Post = await getPostData(params.id);
3030

3131
return (
3232
<>
@@ -39,5 +39,5 @@ export default async function Post({ params }: Props) {
3939
<div dangerouslySetInnerHTML={{ __html: data.content }} />
4040
</div>
4141
</>
42-
)
42+
);
4343
}

Diff for: {{cookiecutter.project_slug}}/frontend/app/blog/page.tsx

+18-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
import Link from "next/link"
2-
import { getSortedPostsData } from "../lib/utilities/posts"
3-
import { readableDate } from "../lib/utilities/textual"
1+
import Link from "next/link";
2+
import { getSortedPostsData } from "../lib/utilities/posts";
3+
import { readableDate } from "../lib/utilities/textual";
44

55
type PostMeta = {
6-
id: string
7-
title: string
8-
description: string
9-
author: string
10-
publishedAt: string
11-
categories: string[]
12-
}
6+
id: string;
7+
title: string;
8+
description: string;
9+
author: string;
10+
publishedAt: string;
11+
categories: string[];
12+
};
1313

14-
const title = "Recent blog posts"
15-
const description = "Thoughts from the world of me."
14+
const title = "Recent blog posts";
15+
const description = "Thoughts from the world of me.";
1616

1717
const renderPost = (post: PostMeta) => {
1818
let categories = post.categories.map((category) => (
@@ -22,7 +22,7 @@ const renderPost = (post: PostMeta) => {
2222
>
2323
{category.trim()}
2424
</span>
25-
))
25+
));
2626

2727
return (
2828
<div key={post.id}>
@@ -42,12 +42,12 @@ const renderPost = (post: PostMeta) => {
4242
</div>
4343
</div>
4444
</div>
45-
)
46-
}
45+
);
46+
};
4747

4848
export default function BlogHome() {
49-
const postsList: PostMeta[] = getSortedPostsData()
50-
const posts = postsList.map((post) => renderPost(post))
49+
const postsList: PostMeta[] = getSortedPostsData();
50+
const posts = postsList.map((post) => renderPost(post));
5151

5252
return (
5353
<main className="max-w-none mx-auto sm:w-3/5 bg-white px-4 pt-10 pb-20 sm:px-6">
@@ -63,5 +63,5 @@ export default function BlogHome() {
6363
</div>
6464
</div>
6565
</main>
66-
)
66+
);
6767
}

Diff for: {{cookiecutter.project_slug}}/frontend/app/components/Footer.tsx

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
"use client"
1+
"use client";
22

3-
import Link from "next/link"
4-
import { siteName } from "../lib/utilities/generic"
3+
import Link from "next/link";
4+
import { siteName } from "../lib/utilities/generic";
55

66
const githubIcon = () => {
77
return (
@@ -17,8 +17,8 @@ const githubIcon = () => {
1717
clipRule="evenodd"
1818
/>
1919
</svg>
20-
)
21-
}
20+
);
21+
};
2222

2323
const mastodonIcon = () => {
2424
return (
@@ -34,8 +34,8 @@ const mastodonIcon = () => {
3434
clipRule="evenodd"
3535
/>
3636
</svg>
37-
)
38-
}
37+
);
38+
};
3939

4040
const footerNavigation = {
4141
main: [
@@ -57,7 +57,7 @@ const footerNavigation = {
5757
icon: mastodonIcon,
5858
},
5959
],
60-
}
60+
};
6161

6262
const renderNavigation = () => {
6363
return footerNavigation.main.map((item) => (
@@ -69,8 +69,8 @@ const renderNavigation = () => {
6969
{item.name}
7070
</Link>
7171
</div>
72-
))
73-
}
72+
));
73+
};
7474

7575
const renderSocials = () => {
7676
return footerNavigation.social.map((item) => (
@@ -82,8 +82,8 @@ const renderSocials = () => {
8282
<span className="sr-only">{item.name}</span>
8383
{item.icon()}
8484
</a>
85-
))
86-
}
85+
));
86+
};
8787

8888
export default function Footer() {
8989
return (
@@ -105,5 +105,5 @@ export default function Footer() {
105105
</div>
106106
</div>
107107
</footer>
108-
)
108+
);
109109
}

Diff for: {{cookiecutter.project_slug}}/frontend/app/components/Navigation.tsx

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
"use client"
1+
"use client";
22

3-
import { Disclosure } from "@headlessui/react"
4-
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline"
5-
import Link from "next/link"
6-
import AlertsButton from "./alerts/AlertsButton"
7-
import dynamic from "next/dynamic"
3+
import { Disclosure } from "@headlessui/react";
4+
import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline";
5+
import Link from "next/link";
6+
import AlertsButton from "./alerts/AlertsButton";
7+
import dynamic from "next/dynamic";
88
const AuthenticationNavigation = dynamic(
99
() => import("./authentication/AuthenticationNavigation"),
1010
{ ssr: false },
11-
)
11+
);
1212

1313
const navigation = [
1414
{ name: "About", to: "/about" },
1515
{ name: "Authentication", to: "/authentication" },
1616
{ name: "Blog", to: "/blog" },
17-
]
17+
];
1818

1919
const renderIcon = (open: boolean) => {
2020
if (!open) {
21-
return <Bars3Icon className="block h-6 w-6" aria-hidden="true" />
21+
return <Bars3Icon className="block h-6 w-6" aria-hidden="true" />;
2222
} else {
23-
return <XMarkIcon className="block h-6 w-6" aria-hidden="true" />
23+
return <XMarkIcon className="block h-6 w-6" aria-hidden="true" />;
2424
}
25-
}
25+
};
2626

2727
const renderNavLinks = (style: string) => {
2828
return navigation.map((nav) => (
2929
<Link href={nav.to} key={nav.name} className={style}>
3030
{nav.name}
3131
</Link>
32-
))
33-
}
32+
));
33+
};
3434
export default function Navigation() {
3535
return (
3636
<header>
@@ -84,5 +84,5 @@ export default function Navigation() {
8484
)}
8585
</Disclosure>
8686
</header>
87-
)
87+
);
8888
}

0 commit comments

Comments
 (0)