-
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.
* Update to use slugs instead of query params * Some cleanup * Spinning up blog core * Updating the Blog home * Working on layout * Adding post preview * Building new design * Updating more of the design * Typescript incident * Some cleanup * Blog stuff * Adding summary * Adding subtitle * Blog * Adding some Footer * Some cleanup * Update thumb * Some cleanup * Some cleanup * Fixing some bugs * Blog CTA more responsive * Update hop-on-our-soapbox.md * Update hop-on-our-soapbox.md * Update hop-on-our-soapbox.md Co-authored-by: Dean Eigenmann <[email protected]>
- Loading branch information
Showing
28 changed files
with
1,630 additions
and
444 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,15 @@ | ||
import { APP_STORE_URL } from "../constants"; | ||
import Apple from "../icons/apple"; | ||
|
||
export default function AppStoreButton() { | ||
return ( | ||
<a | ||
className="py-4 px-6 bg-brand text-white rounded-full inline-flex justify-center items-center space-x-3 focus:outline-none focus:ring-4" | ||
href={APP_STORE_URL} | ||
aria-label="Download on the App Store" | ||
> | ||
<Apple size={32} className="-mt-0.5" /> | ||
<span className="text-2xl font-medium">App Store</span> | ||
</a> | ||
); | ||
} |
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,26 @@ | ||
import Image from "next/image"; | ||
|
||
export default function PostPreview({ title, date, authors }) { | ||
return ( | ||
<div className="room"> | ||
<div className="room-title">{title}</div> | ||
<div className="flex items-center justify-between"> | ||
<div className="flex -space-x-2"> | ||
{authors.map((member, i) => ( | ||
<div key={i} className="flex room-head overflow-visible"> | ||
<Image | ||
height={50} | ||
width={50} | ||
className="room-head object-cover object-center rounded-full" | ||
draggable="false" | ||
src={member.image} | ||
alt={member.displayName} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
<div className="no-underline room-button">{date}</div> | ||
</div> | ||
</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
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 |
---|---|---|
|
@@ -6,3 +6,9 @@ export const CONTACT_URL = "mailto:[email protected]"; | |
export const APP_ID = "1529283270"; | ||
|
||
export const APP_NAME = "Soapbox: Talk with anyone"; | ||
|
||
export const TWITTER_URL = | ||
"https://twitter.com/intent/user?screen_name=joinsoapbox"; | ||
|
||
export const MEDIA_KIT_URL = | ||
"https://www.notion.so/Media-Kit-f122893891b84cb5a19a8744b770f847"; |
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 @@ | ||
export default function Twitter({ size = 24, className = "" }) { | ||
return ( | ||
<svg | ||
className={className} | ||
width={size} | ||
height={size} | ||
viewBox="0 0 24 24" | ||
xmlns="http://www.w3.org/2000/svg" | ||
fill="currentColor" | ||
> | ||
<title>{"Twitter"}</title> | ||
<path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723c-.951.555-2.005.959-3.127 1.184a4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z" /> | ||
</svg> | ||
); | ||
} |
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,39 @@ | ||
import fs from "fs"; | ||
import matter from "gray-matter"; | ||
import renderToString from "next-mdx-remote/render-to-string"; | ||
import { join } from "path"; | ||
|
||
const docsDirectory = join(process.cwd(), "posts"); | ||
|
||
export async function getPostBySlug(slug: string) { | ||
const fullPath = join(docsDirectory, `${slug}.md`); | ||
const fileContents = fs.readFileSync(fullPath, "utf8"); | ||
|
||
const { data, content } = matter(fileContents); | ||
|
||
const source = await renderToString(content); | ||
|
||
return { | ||
slug, | ||
meta: data, | ||
source, | ||
}; | ||
} | ||
|
||
export function getAllPosts() { | ||
const filenames = fs.readdirSync(docsDirectory); | ||
|
||
return filenames.map((file) => ({ | ||
slug: file.replace(/\.md$/, ""), | ||
})); | ||
} | ||
|
||
export async function getAllPostsWithData() { | ||
const posts = getAllPosts(); | ||
|
||
const postsWithData = await Promise.all( | ||
posts.map(async (post) => await getPostBySlug(post.slug)) | ||
); | ||
|
||
return postsWithData; | ||
} |
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,16 +1,17 @@ | ||
import type { AppProps } from "next/app"; | ||
import { Fragment } from "react"; | ||
import Footer from "../components/footer"; | ||
import Navigation from "../components/navigation"; | ||
import "../styles/globals.css"; | ||
|
||
export default function SoapboxApp({ Component, pageProps }: AppProps) { | ||
return ( | ||
<div className="flex flex-col min-h-screen"> | ||
<Fragment> | ||
<Navigation /> | ||
|
||
<Component {...pageProps} /> | ||
|
||
<Footer /> | ||
</div> | ||
</Fragment> | ||
); | ||
} |
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,116 @@ | ||
import type { GetStaticPaths, InferGetStaticPropsType } from "next"; | ||
import hydrate from "next-mdx-remote/hydrate"; | ||
import Image from "next/image"; | ||
import Meta from "../../components/meta"; | ||
import { APP_STORE_URL, TWITTER_URL } from "../../constants"; | ||
import Apple from "../../icons/apple"; | ||
import Twitter from "../../icons/twitter"; | ||
import { getAllPosts, getPostBySlug } from "../../lib"; | ||
|
||
type Props = InferGetStaticPropsType<typeof getStaticProps>; | ||
|
||
export default function Post({ slug, meta, source }: Props) { | ||
const content = hydrate(source); | ||
|
||
const hasAuthors = meta?.authors?.length > 0; | ||
|
||
return ( | ||
<main className="p-5"> | ||
<Meta | ||
title={meta.title} | ||
description={meta.summary} | ||
url={`https://soapbox.social/blog/${slug}`} | ||
/> | ||
|
||
<div className="max-w-2xl w-full mx-auto p-5 md:p-10 bg-white rounded-room"> | ||
<div className="space-y-4"> | ||
<h1 className="text-4xl font-extrabold leading-none text-prose-primary"> | ||
{meta.title} | ||
</h1> | ||
|
||
<p className="text-prose-secondary"> | ||
<strong>{meta.date}</strong> | ||
</p> | ||
|
||
{hasAuthors && ( | ||
<div className="flex -space-x-2"> | ||
{meta.authors.map((member, i: number) => ( | ||
<div key={i} className="flex room-head overflow-visible"> | ||
<Image | ||
height={50} | ||
width={50} | ||
className="room-head object-cover object-center rounded-full" | ||
draggable="false" | ||
src={member.image} | ||
alt={member.displayName} | ||
/> | ||
</div> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
|
||
<div className="h-8" /> | ||
|
||
<div className="prose max-w-none">{content}</div> | ||
</div> | ||
|
||
<div className="h-4" /> | ||
|
||
<div className="max-w-2xl w-full mx-auto p-5 md:p-10 bg-white rounded-room"> | ||
<div className="text-center text-prose-secondary"> | ||
<p className="text-4xl font-extrabold leading-none text-prose-primary"> | ||
Join Soapbox | ||
</p> | ||
|
||
<div className="h-4" /> | ||
|
||
<p>Download Soapbox on iOS and follow us on Twitter.</p> | ||
|
||
<div className="h-8" /> | ||
|
||
<div className="max-w-md mx-auto sm:flex justify-center sm:space-x-2 space-y-4 sm:space-y-0"> | ||
<a | ||
className="py-2 px-4 bg-brand text-white rounded-full flex justify-center items-center space-x-2 focus:outline-none focus:ring-4" | ||
href={APP_STORE_URL} | ||
aria-label="Download on the App Store" | ||
> | ||
<Apple size={24} className="-mt-0.5" /> | ||
<span className="text-lg font-medium">App Store</span> | ||
</a> | ||
|
||
<a | ||
className="py-2 px-4 bg-brand text-white rounded-full flex justify-center items-center space-x-2 focus:outline-none focus:ring-4" | ||
href={TWITTER_URL} | ||
aria-label="Download on the App Store" | ||
> | ||
<Twitter size={24} /> | ||
<span className="text-lg font-medium">Twitter</span> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</main> | ||
); | ||
} | ||
|
||
export const getStaticProps = async ({ params }) => { | ||
return { | ||
props: await getPostBySlug(params.slug), | ||
}; | ||
}; | ||
|
||
export const getStaticPaths: GetStaticPaths = async () => { | ||
const posts = getAllPosts(); | ||
|
||
return { | ||
paths: posts.map((post) => { | ||
return { | ||
params: { | ||
slug: post.slug, | ||
}, | ||
}; | ||
}), | ||
fallback: false, | ||
}; | ||
}; |
Oops, something went wrong.