-
Notifications
You must be signed in to change notification settings - Fork 550
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
1 parent
5fe48ef
commit 82645c5
Showing
24 changed files
with
427 additions
and
112 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 |
---|---|---|
@@ -1,30 +1,17 @@ | ||
import Hero from "@/components/hero"; | ||
import { Mdx } from "@/components/mdx-components"; | ||
import ComponentDemos from "@/components/sections/component-demos"; | ||
import Hero from "@/components/sections/hero"; | ||
import Showcase from "@/components/sections/showcase"; | ||
import Testimonials from "@/components/sections/testimonials"; | ||
|
||
import "@/styles/mdx.css"; | ||
|
||
import { notFound } from "next/navigation"; | ||
import { allPages } from "contentlayer/generated"; | ||
|
||
import Testimonials from "@/components/testimonials"; | ||
|
||
const PAGE = "home"; | ||
|
||
export default async function Home() { | ||
const page = allPages.find((page) => page.slugAsParams === PAGE); | ||
|
||
if (!page) { | ||
notFound(); | ||
} | ||
|
||
return ( | ||
<> | ||
<Hero /> | ||
<section id="component-demos" className="container max-w-5xl"> | ||
<Mdx code={page.body.code} /> | ||
</section> | ||
<Showcase /> | ||
<ComponentDemos /> | ||
<Testimonials /> | ||
{/* <CTASection /> */} | ||
</> | ||
); | ||
} |
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,98 @@ | ||
import { Metadata } from "next"; | ||
import { notFound } from "next/navigation"; | ||
import { env } from "@/env.mjs"; | ||
import { allShowcases } from "contentlayer/generated"; | ||
|
||
import { siteConfig } from "@/config/site"; | ||
import { absoluteUrl } from "@/lib/utils"; | ||
import { ShowcaseCard } from "@/components/sections/showcase"; | ||
|
||
interface PageProps { | ||
params: { | ||
slug: string[]; | ||
}; | ||
} | ||
|
||
async function getPageFromParams(params: PageProps["params"]) { | ||
const slug = params?.slug?.join("/"); | ||
const page = allShowcases.find((page) => page.slugAsParams === slug); | ||
|
||
if (!page) { | ||
null; | ||
} | ||
|
||
return page; | ||
} | ||
|
||
export async function generateMetadata({ | ||
params, | ||
}: PageProps): Promise<Metadata> { | ||
const page = await getPageFromParams(params); | ||
|
||
if (!page) { | ||
return {}; | ||
} | ||
|
||
const url = env.NEXT_PUBLIC_APP_URL; | ||
|
||
const ogUrl = new URL(`${url}/api/og`); | ||
ogUrl.searchParams.set("heading", page.title); | ||
ogUrl.searchParams.set("type", siteConfig.name); | ||
ogUrl.searchParams.set("mode", "light"); | ||
|
||
return { | ||
title: page.title, | ||
description: page.description, | ||
openGraph: { | ||
title: page.title, | ||
description: page.description, | ||
type: "article", | ||
url: absoluteUrl(page.slug), | ||
images: [ | ||
{ | ||
url: ogUrl.toString(), | ||
width: 1200, | ||
height: 630, | ||
alt: page.title, | ||
}, | ||
], | ||
}, | ||
twitter: { | ||
card: "summary_large_image", | ||
title: page.title, | ||
description: page.description, | ||
images: [ogUrl.toString()], | ||
}, | ||
}; | ||
} | ||
|
||
export async function generateStaticParams(): Promise<PageProps["params"][]> { | ||
return allShowcases.map((page) => ({ | ||
slug: page.slugAsParams.split("/"), | ||
})); | ||
} | ||
|
||
export default async function PagePage({ params }: PageProps) { | ||
const page = await getPageFromParams(params); | ||
|
||
if (!page) { | ||
notFound(); | ||
} | ||
|
||
return ( | ||
<article className="container py-14 max-w-2xl"> | ||
<h2 className="mb-4 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground"> | ||
{page.title} | ||
</h2> | ||
<h3 className="mx-auto mb-8 text-balance text-center text-lg font-medium tracking-tight text-foreground/80"> | ||
{page.title} uses Magic UI to build their landing page. | ||
</h3> | ||
<ShowcaseCard | ||
title={page.title} | ||
href={page.href} | ||
image={page.image} | ||
affiliation={page.affiliation} | ||
/> | ||
</article> | ||
); | ||
} |
Oops, something went wrong.