Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 51e0a39

Browse files
committed
wip guides
1 parent 3c6574f commit 51e0a39

File tree

7 files changed

+180
-0
lines changed

7 files changed

+180
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@prisma/client": "^5.20.0",
3030
"@radix-ui/react-accordion": "^1.2.0",
3131
"@radix-ui/react-avatar": "^1.1.0",
32+
"@radix-ui/react-checkbox": "^1.1.2",
3233
"@radix-ui/react-collapsible": "^1.1.0",
3334
"@radix-ui/react-dialog": "^1.1.1",
3435
"@radix-ui/react-icons": "^1.3.0",

src/app/guides/page.tsx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import Breadcrumbs from '@/components/Breadcrumbs'
2+
import GuideList from '@/components/guides/GuideList'
3+
import {
4+
Breadcrumb,
5+
BreadcrumbItem,
6+
BreadcrumbLink,
7+
BreadcrumbList,
8+
BreadcrumbPage,
9+
BreadcrumbSeparator,
10+
} from '@/components/ui/breadcrumb'
11+
import { Heading } from '@/components/ui/heading'
12+
import { allDocs } from '@/content'
13+
import Link from 'next/link'
14+
15+
export default function GuidesPage() {
16+
const allGuides = allDocs.filter((doc) => doc.slug.startsWith('guides/'))
17+
18+
return (
19+
<div className="mx-auto flex h-full max-w-7xl flex-col gap-y-10 px-4 pb-10 pt-16">
20+
<Breadcrumb>
21+
<BreadcrumbList>
22+
<BreadcrumbItem>
23+
<BreadcrumbLink asChild>
24+
<Link href={'/'}>Docs</Link>
25+
</BreadcrumbLink>
26+
</BreadcrumbItem>
27+
<BreadcrumbSeparator />
28+
<BreadcrumbItem>
29+
<BreadcrumbPage>Guides</BreadcrumbPage>
30+
</BreadcrumbItem>
31+
</BreadcrumbList>
32+
</Breadcrumb>
33+
<Heading level={1}>Guides</Heading>
34+
<GuideList guides={allGuides} allTags={[]} />
35+
</div>
36+
)
37+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { Doc } from '@/content'
2+
import Image from 'next/image'
3+
import React from 'react'
4+
import { cn } from '@/lib/utils'
5+
import Link from 'next/link'
6+
7+
interface Props {
8+
guide: Doc
9+
featured?: boolean
10+
}
11+
12+
const guide: React.FC<Props> = ({ guide, featured }) => {
13+
return (
14+
<Link
15+
href={`/${guide.slug}`}
16+
className={
17+
'group flex overflow-hidden rounded-lg p-3 transition-colors hover:bg-gray-700/30 hover:text-white dark:text-white ' +
18+
(featured ? 'flex-col lg:flex-row' : 'flex-col')
19+
}
20+
>
21+
<div>
22+
<p
23+
className={cn(
24+
'font-display text-xl font-semibold',
25+
featured ? 'lg:text-2xl xl:text-3xl' : '',
26+
)}
27+
>
28+
{guide.title}
29+
</p>
30+
<p
31+
className={cn(
32+
'text-md mt-3 text-base text-foreground-light',
33+
featured ? 'lg:text-md' : '',
34+
)}
35+
>
36+
{guide.description}
37+
</p>
38+
</div>
39+
</Link>
40+
)
41+
}
42+
43+
export default guide
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { Doc } from '@/content'
2+
import React from 'react'
3+
import { Separator } from '../ui/separator'
4+
import Link from 'next/link'
5+
import { cn } from '@/lib/utils'
6+
import { title } from 'radash'
7+
import GuideItem from './GuideItem'
8+
import { Checkbox } from '../ui/checkbox'
9+
10+
interface Props {
11+
guides: Doc[]
12+
allTags: string[]
13+
}
14+
15+
const GuideList: React.FC<Props> = ({ guides, allTags }) => {
16+
allTags = ['python', 'node', 'go']
17+
18+
return (
19+
<div className="mt-10 grid grid-cols-[280px,1fr]">
20+
<aside
21+
aria-label="Sidebar"
22+
className="sticky top-[calc(var(--header-height)+1px+2rem)] max-h-[calc(100vh-var(--header-height)-3rem)] w-80 overflow-y-auto"
23+
>
24+
<ul className="space-y-4">
25+
{allTags.map((tag) => (
26+
<li key={tag}>
27+
<div className="flex items-center space-x-4">
28+
<Checkbox id={tag} />
29+
<label
30+
htmlFor={tag}
31+
className="cursor-pointer text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
32+
>
33+
{title(tag)}
34+
</label>
35+
</div>
36+
</li>
37+
))}
38+
</ul>
39+
</aside>
40+
<ul className="space-y-4">
41+
{guides.map((guide) => (
42+
<li key={guide.title}>
43+
<GuideItem guide={guide} />
44+
</li>
45+
))}
46+
</ul>
47+
</div>
48+
)
49+
}
50+
51+
export default GuideList

src/components/ui/checkbox.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
'use client'
2+
3+
import * as React from 'react'
4+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
5+
import { CheckIcon } from '@radix-ui/react-icons'
6+
7+
import { cn } from '@/lib/utils'
8+
9+
const Checkbox = React.forwardRef<
10+
React.ElementRef<typeof CheckboxPrimitive.Root>,
11+
React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
12+
>(({ className, ...props }, ref) => (
13+
<CheckboxPrimitive.Root
14+
ref={ref}
15+
className={cn(
16+
'peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
17+
className,
18+
)}
19+
{...props}
20+
>
21+
<CheckboxPrimitive.Indicator
22+
className={cn('flex items-center justify-center text-current')}
23+
>
24+
<CheckIcon className="h-4 w-4" />
25+
</CheckboxPrimitive.Indicator>
26+
</CheckboxPrimitive.Root>
27+
))
28+
Checkbox.displayName = CheckboxPrimitive.Root.displayName
29+
30+
export { Checkbox }

src/config/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ export const navigation: NavEntry[] = [
1212
title: 'Introduction',
1313
href: '/',
1414
},
15+
{
16+
title: 'Guides',
17+
href: '/guides',
18+
},
1519
{
1620
title: 'Concepts',
1721
items: [

yarn.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,6 +1264,20 @@
12641264
"@radix-ui/react-use-callback-ref" "1.1.0"
12651265
"@radix-ui/react-use-layout-effect" "1.1.0"
12661266

1267+
"@radix-ui/react-checkbox@^1.1.2":
1268+
version "1.1.2"
1269+
resolved "https://registry.yarnpkg.com/@radix-ui/react-checkbox/-/react-checkbox-1.1.2.tgz#6465b800420923ecc39cbeaa8f357b5f09dbfd52"
1270+
integrity sha512-/i0fl686zaJbDQLNKrkCbMyDm6FQMt4jg323k7HuqitoANm9sE23Ql8yOK3Wusk34HSLKDChhMux05FnP6KUkw==
1271+
dependencies:
1272+
"@radix-ui/primitive" "1.1.0"
1273+
"@radix-ui/react-compose-refs" "1.1.0"
1274+
"@radix-ui/react-context" "1.1.1"
1275+
"@radix-ui/react-presence" "1.1.1"
1276+
"@radix-ui/react-primitive" "2.0.0"
1277+
"@radix-ui/react-use-controllable-state" "1.1.0"
1278+
"@radix-ui/react-use-previous" "1.1.0"
1279+
"@radix-ui/react-use-size" "1.1.0"
1280+
12671281
"@radix-ui/[email protected]", "@radix-ui/react-collapsible@^1.1.0":
12681282
version "1.1.1"
12691283
resolved "https://registry.yarnpkg.com/@radix-ui/react-collapsible/-/react-collapsible-1.1.1.tgz#1382cc9ec48f8b473c14f3779d317f0cdf6da5e9"

0 commit comments

Comments
 (0)