-
Notifications
You must be signed in to change notification settings - Fork 2
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 #30 from atlantabitdevs/28-events-and-posts
Create events page and posts page
- Loading branch information
Showing
11 changed files
with
145 additions
and
302 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { FC } from 'react' | ||
import { allDocs } from 'contentlayer/generated' | ||
import { Mdx } from '@/components/MDX-components' | ||
|
||
interface PageProps { | ||
params: { | ||
slug: string | ||
} | ||
} | ||
|
||
async function getDocFromParams(slug: string) { | ||
const post = allDocs.find((post) => post.slugAsParams === slug) | ||
return post | ||
} | ||
|
||
const page = async ({ params }: PageProps) => { | ||
const post = await getDocFromParams(params.slug) | ||
|
||
if (!post) { | ||
return <div>404 sorry you poor bitdev</div> | ||
} | ||
|
||
console.log(post._raw.flattenedPath) | ||
|
||
// return <div>{JSON.stringify(post)}</div> | ||
return ( | ||
<div> | ||
<Mdx code={post.body.code} /> | ||
</div> | ||
) | ||
} | ||
|
||
export default page |
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 Link from 'next/link' | ||
import { | ||
ContentType, | ||
getSortedMarkdownContent, | ||
} from '../../lib/parse-markdown-files' | ||
import MeetupName from '@/components/MeetupName' | ||
|
||
export default function Posts({ params }: { params: any }) { | ||
console.log('params.contentType: ', params.contentType) | ||
const contentType = params.contentType | ||
const allContentData = getSortedMarkdownContent(contentType) | ||
return ( | ||
<main className="flex min-h-screen flex-col items-center justify-between p-24"> | ||
<MeetupName /> | ||
<h1>This is the Posts page, bruh</h1> | ||
<Link href="/" style={{ textDecoration: 'underline' }}> | ||
Home | ||
</Link> | ||
<ul> | ||
{allContentData.map(({ id, date, title }) => ( | ||
<li className="post" key={id}> | ||
{title} | ||
<br /> | ||
{id} | ||
<br /> | ||
{date} | ||
</li> | ||
))} | ||
</ul> | ||
</main> | ||
) | ||
} |
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 |
---|---|---|
@@ -1,69 +1,20 @@ | ||
import Link from 'next/link' | ||
import { getSortedPostsData } from '../lib/parse-posts' | ||
import MeetupName from '@/components/MeetupName' | ||
|
||
const allPostsData = getSortedPostsData() | ||
|
||
export default function Home({}) { | ||
return ( | ||
<main className="flex min-h-screen flex-col items-center justify-between p-24"> | ||
<MeetupName /> | ||
<h1>This is the home page, bruh</h1> | ||
<Link href="/events">Events</Link> | ||
<ul> | ||
{allPostsData.map(({ id, date, title }) => ( | ||
<li className="post" key={id}> | ||
{title} | ||
<br /> | ||
{id} | ||
<br /> | ||
{date} | ||
</li> | ||
))} | ||
</ul> | ||
<hr /> | ||
<h2>The Events component goes here.</h2> | ||
<Link href="/events" style={{ textDecoration: 'underline' }}> | ||
Click here to see all events... | ||
</Link> | ||
<h2>The Posts component goes here.</h2> | ||
<Link href="/posts" style={{ textDecoration: 'underline' }}> | ||
Click here to see all posts... | ||
</Link> | ||
</main> | ||
) | ||
} | ||
// import Link from 'next/link' | ||
|
||
// import { FC } from 'react' | ||
// import {allDocs} from "contentlayer/generated" | ||
// import { Mdx } from '@/components/MDX-components'; | ||
|
||
// interface PageProps { | ||
// params: { | ||
// slug: string | ||
// } | ||
// } | ||
|
||
// // async fucntion getDocFromParams(slug: string) { | ||
// // const post = allDocs.find((post) => post.slugAsParams === slug); | ||
// // return post; | ||
// // } | ||
|
||
// async function getDocFromParams(slug: string) { | ||
// // const post = allDocs.find((post) => post.slugAsParams === slug); | ||
// const post = allDocs[0] | ||
// // console.log(allDocs) | ||
// return post; | ||
// } | ||
|
||
// const page = async ({ params }: PageProps) => { | ||
// const post = await getDocFromParams(params.slug) | ||
|
||
// console.log(post._raw.flattenedPath) | ||
|
||
// // return <div>{JSON.stringify(post)}</div> | ||
// return <div> | ||
// {/* <Mdx code={post.body.code} /> */} | ||
// {/* <Link href="/events/first-event">"hello"</Link> */} | ||
// {/* <Link href="${post._raw.flattenedPath}">"hello"</Link> */} | ||
// {/* <Link href="/" | ||
// onClick= | ||
// "location.href=this.href+post._raw.flattenedPath;return false;" | ||
// >hello</Link> */} | ||
|
||
// </div> | ||
// } | ||
|
||
// export default page |
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,9 @@ | ||
--- | ||
date: '2023-07-29.md' | ||
title: 'Socratic Seminar for 2023-07-29' | ||
type: Doc | ||
--- | ||
|
||
This is the body of the event for 2023-07-29. | ||
|
||
Bitcoin ipsum... |
Empty file.
Oops, something went wrong.