Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions src/app/[postSlug]/page.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import React from 'react';
import React from "react";
import { MDXRemote } from "next-mdx-remote/rsc";

import BlogHero from '@/components/BlogHero';
import BlogHero from "@/components/BlogHero";

import styles from './postSlug.module.css';
import styles from "./postSlug.module.css";
import { loadBlogPost } from "@/helpers/file-helpers";

async function BlogPost({ params }) {
const { frontmatter, content } = await loadBlogPost(params.postSlug);

function BlogPost() {
return (
<article className={styles.wrapper}>
<BlogHero
title="Example post!"
publishedOn={new Date()}
title={frontmatter.title}
publishedOn={frontmatter.publishedOn}
/>
<div className={styles.page}>
<p>This is where the blog post will go!</p>
<p>
You will need to use <em>MDX</em> to render all of
the elements created from the blog post in this
spot.
</p>
<MDXRemote source={content} />
</div>
</article>
);
Expand Down
31 changes: 17 additions & 14 deletions src/app/page.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import React from 'react';
import React from "react";

import BlogSummaryCard from '@/components/BlogSummaryCard';
import BlogSummaryCard from "@/components/BlogSummaryCard";
import { getBlogPostList } from "@/helpers/file-helpers";

import styles from './homepage.module.css';
import styles from "./homepage.module.css";

async function Home() {
const blogPosts = await getBlogPostList();

function Home() {
return (
<div className={styles.wrapper}>
<h1 className={styles.mainHeading}>
Latest Content:
</h1>
<h1 className={styles.mainHeading}>Latest Content:</h1>

{/* TODO: Iterate over the data read from the file system! */}
<BlogSummaryCard
slug="example"
title="Hello world!"
abstract="This is a placeholder, an example which shows how the “BlogSummaryCard” component should be used. You'll want to swap this out based on the data from the various MDX files!"
publishedOn={new Date()}
/>
{blogPosts.map((blog) => (
<BlogSummaryCard
key={blog.slug}
slug={blog.slug}
title={blog.title}
abstract={blog.abstract}
publishedOn={blog.publishedOn}
/>
))}
</div>
);
}
Expand Down