Skip to content

Commit

Permalink
Add MDX components and layouts for legal pages
Browse files Browse the repository at this point in the history
  • Loading branch information
miurla committed Apr 18, 2024
1 parent fd64261 commit b8010b9
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 29 deletions.
12 changes: 0 additions & 12 deletions app/legal/action.ts

This file was deleted.

9 changes: 9 additions & 0 deletions app/legal/privacy/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function MdxLayout({ children }: { children: React.ReactNode }) {
return (
<div className="max-w-3xl mx-auto px-4 py-16">
<div className="prose-sm prose-neutral prose-a:text-accent-foreground/50">
{children}
</div>
</div>
)
}
10 changes: 3 additions & 7 deletions app/legal/privacy/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import MdContents from '@/components/md-contents'
import { readFile } from '../action'
import Privacy from '@/markdown/privacy.mdx'

export default async function PrivacyPage() {
const res = await readFile('./public/legal', 'privacy.md')
const { fileContents } = await res.json()

return <MdContents content={fileContents} />
export default function Page() {
return <Privacy />
}
9 changes: 9 additions & 0 deletions app/legal/terms/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default function MdxLayout({ children }: { children: React.ReactNode }) {
return (
<div className="max-w-3xl mx-auto px-4 py-16">
<div className="prose-sm prose-neutral prose-a:text-accent-foreground/50">
{children}
</div>
</div>
)
}
10 changes: 3 additions & 7 deletions app/legal/terms/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import MdContents from '@/components/md-contents'
import { readFile } from '../action'
import Terms from '@/markdown/terms.mdx'

export default async function TermsOfUsePage() {
const res = await readFile('./public/legal', 'terms.md')
const { fileContents } = await res.json()

return <MdContents content={fileContents} />
export default function Page() {
return <Terms />
}
Binary file modified bun.lockb
Binary file not shown.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions mdx-components.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { MDXComponents } from 'mdx/types'

export function useMDXComponents(components: MDXComponents): MDXComponents {
return {
...components
}
}
11 changes: 8 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
import createMDX from '@next/mdx'

export default nextConfig;
const nextConfig = {
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx']
}

const withMDX = createMDX()

export default withMDX(nextConfig)
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
},
"dependencies": {
"@ai-sdk/openai": "^0.0.2",
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@next/mdx": "^14.2.2",
"@prisma/client": "^5.12.1",
"@radix-ui/react-avatar": "^1.0.4",
"@radix-ui/react-checkbox": "^1.0.4",
Expand All @@ -25,6 +28,7 @@
"@supabase/ssr": "^0.1.0",
"@supabase/supabase-js": "^2.42.0",
"@tailwindcss/typography": "^0.5.12",
"@types/mdx": "^2.0.13",
"@vercel/analytics": "^1.2.2",
"ai": "^3.0.14",
"class-variance-authority": "^0.7.0",
Expand Down

0 comments on commit b8010b9

Please sign in to comment.