-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: move in static pages and typography * feat: add public prose and static pages * chore: exclude node from props * docs: fix spacing and headers
- Loading branch information
1 parent
d430064
commit b05474d
Showing
9 changed files
with
400 additions
and
1 deletion.
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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,19 @@ | ||
import type { PropsWithChildren } from "react"; | ||
|
||
const Dashboard = ({ children }: PropsWithChildren) => { | ||
return <>{children}</>; | ||
//<Layout> | ||
// <LayoutHero className="pb-28"> | ||
// <Header /> | ||
// <LayoutHeadline className="max-w-screen-md"> | ||
// <LayoutTitle className="text-foreground">Privacy Policy</LayoutTitle> | ||
// </LayoutHeadline> | ||
// </LayoutHero> | ||
// | ||
// <LayoutMain className="prose flex max-w-screen-md flex-col prose-headings:font-display prose-headings:text-foreground prose-li:text-foreground text-foreground marker:text-foreground"> | ||
// {children} | ||
// </LayoutMain> | ||
//</Layout> | ||
}; | ||
|
||
export default Dashboard; |
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,11 @@ | ||
import { PublicProse } from "@/components/PubilcProse"; | ||
|
||
export const metadata = { | ||
title: "Privacy Policy", | ||
}; | ||
|
||
const Page = async () => { | ||
return <PublicProse fileName="privacyPolicy" />; | ||
}; | ||
|
||
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,11 @@ | ||
import { PublicProse } from "@/components/PubilcProse"; | ||
|
||
export const metadata = { | ||
title: "Terms of Use", | ||
}; | ||
|
||
const Page = async () => { | ||
return <PublicProse fileName="termsOfUse" />; | ||
}; | ||
|
||
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,55 @@ | ||
import "server-only"; | ||
import { promises as fs } from "node:fs"; | ||
import path from "node:path"; | ||
import { Anchor } from "@/components/ui/Anchor"; | ||
import Markdown from "react-markdown"; | ||
import rehypeExternalLinks from "rehype-external-links"; | ||
import rehypeSlug from "rehype-slug"; | ||
import remarkGfm from "remark-gfm"; | ||
import remarkTextr from "remark-textr"; | ||
// @ts-expect-error: no typedef from module | ||
import base from "typographic-base"; | ||
|
||
const applyTypographicBase = (prose: string) => { | ||
return base(prose); | ||
}; | ||
|
||
export const PublicProse = async ({ fileName }: { fileName: string }) => { | ||
const file = await fs.readFile( | ||
path.join(process.cwd(), `public/prose/${fileName}.md`), | ||
"utf8", | ||
); | ||
return ( | ||
<main className="prose prose-neutral dark:prose-invert mx-auto max-w-prose py-16 prose-headings:font-display"> | ||
<Markdown | ||
components={{ | ||
a: ({ node, ...props }) => ( | ||
<Anchor href={props.href || ""} variant="highlighted" {...props} /> | ||
), | ||
}} | ||
remarkPlugins={[ | ||
remarkGfm, | ||
[ | ||
remarkTextr, | ||
{ | ||
options: { locale: "en-us" }, | ||
plugins: [applyTypographicBase], | ||
}, | ||
], | ||
]} | ||
rehypePlugins={[ | ||
[ | ||
rehypeExternalLinks, | ||
{ | ||
rel: ["nofollow noreferrer noopener"], | ||
target: "_blank", | ||
}, | ||
], | ||
rehypeSlug, | ||
]} | ||
> | ||
{file} | ||
</Markdown> | ||
</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,64 @@ | ||
import { cn } from "@/lib/cssUtils"; | ||
import { ArrowSquareOut } from "@phosphor-icons/react/dist/ssr/ArrowSquareOut"; | ||
import { Slot } from "@radix-ui/react-slot"; | ||
import { type VariantProps, cva } from "class-variance-authority"; | ||
import Link from "next/link"; | ||
import { type ComponentProps, forwardRef } from "react"; | ||
|
||
const anchorVariants = cva( | ||
"underline-offset-4 focus:ring-ring focus-visible:ring-4 outline-none font-semibold", | ||
{ | ||
variants: { | ||
variant: { | ||
default: "text-foreground hover:underline", | ||
highlighted: "text-primary hover:underline", | ||
muted: "text-muted-foreground hover:underline", | ||
unstyled: "", | ||
}, | ||
}, | ||
defaultVariants: { | ||
variant: "default", | ||
}, | ||
}, | ||
); | ||
|
||
export interface AnchorProps | ||
extends ComponentProps<typeof Link>, | ||
VariantProps<typeof anchorVariants> { | ||
asChild?: boolean; | ||
showExternal?: boolean; | ||
} | ||
|
||
const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>( | ||
( | ||
{ | ||
className, | ||
variant, | ||
asChild = false, | ||
showExternal = false, | ||
children, | ||
...props | ||
}, | ||
ref, | ||
) => { | ||
const Comp = asChild ? Slot : Link; | ||
|
||
return ( | ||
<Comp | ||
className={cn( | ||
anchorVariants({ variant }), | ||
showExternal && "inline-flex items-center gap-1", | ||
className, | ||
)} | ||
ref={ref} | ||
{...props} | ||
> | ||
{children} | ||
{showExternal && <ArrowSquareOut weight="bold" />} | ||
</Comp> | ||
); | ||
}, | ||
); | ||
Anchor.displayName = "Anchor"; | ||
|
||
export { Anchor, anchorVariants }; |
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