-
Notifications
You must be signed in to change notification settings - Fork 1
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 #9 from shunkakinoki/feat/ini-credits-button
feat/ini credits button
- Loading branch information
Showing
15 changed files
with
154 additions
and
90 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.markdown { | ||
@apply leading-relaxed text-black dark:text-white; | ||
} | ||
|
||
.markdown h1 { | ||
@apply my-8 text-6xl font-semibold leading-none tracking-tight dark:text-gray-100; | ||
} | ||
|
||
.markdown h2 { | ||
@apply my-6 text-3xl font-semibold leading-tight text-gray-800 underline; | ||
} | ||
|
||
.markdown ul { | ||
@apply mx-4 my-3 text-lg text-gray-700 list-disc; | ||
} |
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,14 @@ | ||
import hydrate from "next-mdx-remote/hydrate"; | ||
import { MdxRemote } from "next-mdx-remote/types"; | ||
|
||
import s from "./Credits.module.css"; | ||
|
||
export interface Props { | ||
source: MdxRemote.Source; | ||
} | ||
|
||
export default function Credits({ source }: Props): JSX.Element { | ||
const content = hydrate(source); | ||
|
||
return <section className={s.markdown}>{content}</section>; | ||
} |
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,2 @@ | ||
export { default } from "./Credits"; | ||
export type { Props } from "./Credits"; |
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,24 @@ | ||
import Link from "next/link"; | ||
|
||
export default function CreditsButton(): JSX.Element { | ||
return ( | ||
<Link href="/credits"> | ||
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} | ||
<a className="flex items-center justify-center p-2 rounded-full focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-pink-600 dark:focus:ring-pink-400"> | ||
<svg | ||
className="w-6 h-6 text-pink-700 fill-current dark:text-pink-300 hover:text-pink-900 dark:hover:text-pink-100" | ||
stroke="currentColor" | ||
fill="none" | ||
viewBox="0 0 24 24" | ||
aria-hidden="true" | ||
> | ||
<path | ||
fillRule="evenodd" | ||
d="M3.172 5.172a4 4 0 015.656 0L10 6.343l1.172-1.171a4 4 0 115.656 5.656L10 17.657l-6.828-6.829a4 4 0 010-5.656z" | ||
clipRule="evenodd" | ||
/> | ||
</svg> | ||
</a> | ||
</Link> | ||
); | ||
} |
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 @@ | ||
export { default } from "./CreditsButton"; |
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 |
---|---|---|
@@ -1,9 +1,49 @@ | ||
import { NextPage } from "next"; | ||
import { | ||
GetStaticProps, | ||
InferGetStaticPropsType, | ||
GetStaticPaths, | ||
GetStaticPropsContext, | ||
} from "next"; | ||
|
||
import { MdxRemote } from "next-mdx-remote/types"; | ||
|
||
import { getGithubContent } from "@/lib/github"; | ||
import CreditsScreen from "@/screens/CreditsScreen"; | ||
|
||
const Credits: NextPage = () => { | ||
return <CreditsScreen />; | ||
export interface Props { | ||
content: string; | ||
} | ||
|
||
export const getStaticProps: GetStaticProps<Props> = async ({ | ||
locale, | ||
}: // eslint-disable-next-line @typescript-eslint/require-await | ||
GetStaticPropsContext) => { | ||
try { | ||
const result = await getGithubContent("credits", "CREDITS", locale); | ||
if (result) { | ||
const { source } = result; | ||
return { | ||
props: { | ||
content: JSON.stringify(source), | ||
}, | ||
revalidate: 30, | ||
}; | ||
} else { | ||
return { | ||
notFound: true, | ||
}; | ||
} | ||
} catch (error) { | ||
return { | ||
notFound: true, | ||
}; | ||
} | ||
}; | ||
|
||
const Credits = ({ | ||
content, | ||
}: InferGetStaticPropsType<typeof getStaticProps>): JSX.Element => { | ||
return <CreditsScreen source={JSON.parse(content) as MdxRemote.Source} />; | ||
}; | ||
|
||
export default Credits; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
60cbae8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: