-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
442 additions
and
333 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.description { | ||
opacity: 0.6; | ||
} |
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,45 @@ | ||
import { notFound } from "next/navigation"; | ||
import { CustomMDX } from "@/components/mdx"; | ||
import { getPosts } from "@/lib/utils"; | ||
import styles from "./page.module.css"; | ||
import Link from "next/link"; | ||
|
||
export function generateStaticParams() { | ||
const posts = getPosts(); | ||
|
||
return posts.map((post) => ({ | ||
slug: post.slug, | ||
})); | ||
} | ||
|
||
export default async function Blog({ | ||
params, | ||
}: { | ||
params: Promise<{ slug: string }>; | ||
}) { | ||
const slug = (await params).slug; | ||
const post = getPosts().find((post) => post.slug === slug); | ||
|
||
if (!post) { | ||
notFound(); | ||
} | ||
|
||
return ( | ||
<> | ||
<header> | ||
<nav> | ||
<Link href="/">👈 Go back home</Link> | ||
</nav> | ||
</header> | ||
<main> | ||
<h1 className={styles.postHeader}>{post.metadata.title}</h1> | ||
{post.metadata.description && ( | ||
<p className={styles.description}>{post.metadata.description}</p> | ||
)} | ||
<article> | ||
<CustomMDX source={post.content} /> | ||
</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,59 @@ | ||
:root { | ||
--background: #ffffff; | ||
--foreground: #171717; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
--background: #0a0a0a; | ||
--foreground: #ededed; | ||
} | ||
} | ||
|
||
html, | ||
body { | ||
font: 100%/1.5 system-ui; | ||
max-width: 100vw; | ||
overflow-x: hidden; | ||
} | ||
|
||
body { | ||
color: var(--foreground); | ||
background: var(--background); | ||
font-family: Arial, Helvetica, sans-serif; | ||
max-width: 36rem; | ||
margin: 0 auto; | ||
padding: 1.5rem; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
a { | ||
color: inherit; | ||
text-decoration-thickness: 2px; | ||
} | ||
|
||
a:hover { | ||
color: royalblue; | ||
text-decoration-color: currentcolor; | ||
} | ||
|
||
p { | ||
margin-bottom: 1.5rem; | ||
} | ||
|
||
code { | ||
font-family: Menlo; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
html { | ||
color-scheme: dark; | ||
} | ||
} |
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,32 @@ | ||
import type { Metadata } from "next"; | ||
import { Geist, Geist_Mono } from "next/font/google"; | ||
import "./globals.css"; | ||
|
||
const geistSans = Geist({ | ||
variable: "--font-geist-sans", | ||
subsets: ["latin"], | ||
}); | ||
|
||
const geistMono = Geist_Mono({ | ||
variable: "--font-geist-mono", | ||
subsets: ["latin"], | ||
}); | ||
|
||
export const metadata: Metadata = { | ||
title: "MDX Remote App", | ||
description: "Generated by create next app", | ||
}; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
return ( | ||
<html lang="en"> | ||
<body className={`${geistSans.variable} ${geistMono.variable}`}> | ||
{children} | ||
</body> | ||
</html> | ||
); | ||
} |
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,23 @@ | ||
import Link from "next/link"; | ||
import { getPosts } from "@/lib/utils"; | ||
|
||
export default function Home() { | ||
const posts = getPosts(); | ||
|
||
return ( | ||
<main> | ||
<h1>Home Page</h1> | ||
<p> | ||
Click the link below to navigate to a page generated by{" "} | ||
<code>next-mdx-remote</code>. | ||
</p> | ||
<ul> | ||
{posts.map((post) => ( | ||
<li key={post.slug}> | ||
<Link href={`/${post.slug}`}>{post.metadata.title}</Link> | ||
</li> | ||
))} | ||
</ul> | ||
</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,12 @@ | ||
--- | ||
title: Example Post | ||
description: This frontmatter description will appear below the title | ||
--- | ||
|
||
This is an example post, with with a [link](https://nextjs.org) and a React component: | ||
|
||
<Greet name="next-mdx-remote" /> | ||
|
||
Links are rendered using a custom component passed to `next-mdx-remote`. | ||
|
||
Go back [home](/). |
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,5 @@ | ||
--- | ||
title: Hello World | ||
--- | ||
|
||
This is an example post. There's another one [here](/example-post). |
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 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 @@ | ||
.div { | ||
background-color: #111; | ||
border-radius: 0.5em; | ||
color: #fff; | ||
margin-bottom: 1.5em; | ||
padding: 0.5em 0.75em; | ||
} |
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,5 @@ | ||
import styles from "./greet.module.css"; | ||
|
||
export function Greet({ name = "world" }: { name: string }) { | ||
return <div className={styles.div}>Hello, {name}!</div>; | ||
} |
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,4 @@ | ||
.a { | ||
color: tomato; | ||
text-decoration-color: rgba(0, 0, 0, 0.4); | ||
} |
Oops, something went wrong.