-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from io-kobayashiii/feature/#166_upgrade_nextjs
Feature/#166 upgrade nextjs version to 13.4.6
- Loading branch information
Showing
40 changed files
with
874 additions
and
677 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 @@ | ||
type Props = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export default async function RootLayout({ children }: Props) { | ||
return ( | ||
<> | ||
<main className="bg-gray-800 pt-106 pb-50 md:pt-180 md:pb-80"> | ||
<article className="mx-auto max-w-lg px-15 md:px-30"> | ||
{children} | ||
</article> | ||
</main> | ||
</> | ||
); | ||
} |
This file contains 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,7 @@ | ||
export default function NotFound() { | ||
return ( | ||
<h1 className={`mt-16 text-20 font-bold sm:text-24 md:mt-22 md:text-28`}> | ||
Not Found. | ||
</h1> | ||
); | ||
} |
This file contains 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,66 @@ | ||
import ApiClient from '@/utils/ApiClient'; | ||
import { NeumorphismButton } from '@/components/NeumorphismButton'; | ||
import { ArticleBody } from '@/components/ArticleBody'; | ||
import { notFound } from 'next/navigation'; | ||
import { ApplyHooks } from '@/components/ApplyHooks/ApplyHooks'; | ||
import 'highlight.js/styles/base16/atelier-forest.css'; | ||
import { Metadata } from 'next'; | ||
|
||
export async function generateStaticParams() { | ||
const articles = await ApiClient.articles(); | ||
if (!articles) return []; | ||
return articles.contents?.map(({ id }) => ({ id })) ?? []; | ||
} | ||
|
||
type Props = { | ||
params: { | ||
id: string; | ||
}; | ||
}; | ||
|
||
export async function generateMetadata({ | ||
params: { id }, | ||
}: Props): Promise<Metadata> { | ||
const article = await ApiClient.article(id); | ||
|
||
return { | ||
title: article?.title ?? 'For', | ||
description: article?.description, | ||
}; | ||
} | ||
|
||
export default async function Page({ params: { id } }: Props) { | ||
const article = await ApiClient.article(id); | ||
if (!article) notFound(); | ||
return ( | ||
<> | ||
<p className="text-14 md:text-18"> | ||
{new Date(article.publishedAt) | ||
.toLocaleDateString('ja-JP', { | ||
timeZone: 'Asia/Tokyo', | ||
}) | ||
.replaceAll('/', '.')} | ||
</p> | ||
<h1 className={`mt-16 text-20 font-bold sm:text-24 md:mt-22 md:text-28`}> | ||
{article.title} | ||
</h1> | ||
<div className="m-minus-5 mt-15 flex flex-wrap md:mt-25"> | ||
{article.categories.map((category, index) => { | ||
return ( | ||
<NeumorphismButton | ||
key={index} | ||
unevenness={'dents'} | ||
shadowColor={'default'} | ||
displayText={category.name} | ||
className={ | ||
'pointer-events-none m-5 rounded-100vh py-5 px-15 text-12 md:py-8 md:px-12 md:text-14' | ||
} | ||
/> | ||
); | ||
})} | ||
</div> | ||
<ArticleBody articleBody={article.body ?? ''} /> | ||
<ApplyHooks /> | ||
</> | ||
); | ||
} |
This file contains 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,9 @@ | ||
export default function NotFound() { | ||
return ( | ||
<main className="bg-gray-800 pt-76 pb-20 md:pt-180 md:pb-80"> | ||
<div className="mx-auto max-w-lg px-15 md:px-30"> | ||
<h1 className="text-24">Not found.</h1> | ||
</div> | ||
</main> | ||
); | ||
} |
Oops, something went wrong.