Skip to content

Feat/add contributors section #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
37 changes: 37 additions & 0 deletions content/contributors/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

export const contributors = [
{ name: "Alice Johnson", role: "Technical Writer", avatar: "https://github.com/shadcn.png" },
{ name: "Bob Williams", role: "Docs Maintainer", avatar: "https://github.com/shadcn.png" },
{ name: "David Wilson", role: "Content Strategist", avatar: "https://github.com/shadcn.png" },
{ name: "Emma Davis", role: "Markdown Specialist", avatar: "https://github.com/shadcn.png" },
{ name: "Frank Miller", role: "Docs Automation Engineer", avatar: "https://github.com/shadcn.png" },
{ name: "John Doe", role: "Frontend Engineer", avatar: "https://github.com/shadcn.png" },
{ name: "Jane Smith", role: "Backend Engineer", avatar: "https://github.com/shadcn.png" },
];

export const maxVisibleContributors = 3;


<div className="flex flex-col gap-3 p-3">
<CardDescription>Contributors</CardDescription>

<div className="grid grid-cols-1 gap-2">
{contributors.slice(0, maxVisibleContributors).map((contributor, index) => (
<Card key={index} className="flex flex-row items-center justify-between py-2 px-3">
<div className="text-left flex flex-col gap-1 p-1 w-36">
<CardTitle className="text-sm">{contributor.name}</CardTitle>
<CardDescription className="text-xs">{contributor.role}</CardDescription>
</div>
<Avatar className="w-8 h-8">
<AvatarImage src={contributor.avatar} alt={contributor.name} />
<AvatarFallback>{contributor.name[0]}</AvatarFallback>
</Avatar>
</Card>
))}
</div>
{contributors.length > maxVisibleContributors && (
<div className="text-sm pl-5 text-muted-foreground">
+{contributors.length - maxVisibleContributors} more
</div>
)}
</div>
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"dependencies": {
"@hookform/resolvers": "^3.9.1",
"@radix-ui/react-accordion": "^1.2.2",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-collapsible": "^1.1.2",
"@radix-ui/react-dialog": "^1.1.4",
"@radix-ui/react-dropdown-menu": "^2.1.4",
Expand Down
2 changes: 1 addition & 1 deletion src/app/(routes)/ai-sdk/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default async function DocPage({ params }: { params: Promise<DocPageProps
</div>
</div>
<div className="hidden text-sm xl:block">
<div className="sticky top-16 -mt-10 h-[calc(100vh-3.5rem)] pt-4">
<div className="sticky top-8 h-[calc(100vh-3.5rem)] pt-4">
{doc.toc.visible && (
<DashboardTableOfContents toc={doc.toc.content} />
)}
Expand Down
4 changes: 2 additions & 2 deletions src/app/(routes)/guide/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export async function generateMetadata({
{
url: siteConfig.og,
width: 2880,
height: 1800,
height: 1800,
alt: siteConfig.name,
},
],
Expand Down Expand Up @@ -128,7 +128,7 @@ export default async function GuidePage({ params }: { params: Promise<DocPagePro
</div>
</div>
<div className="hidden text-sm xl:block">
<div className="sticky top-16 -mt-10 h-[calc(100vh-3.5rem)] pt-4">
<div className="sticky top-8 h-[calc(100vh-3.5rem)] pt-4">
{doc.toc.visible && (
<DashboardTableOfContents toc={doc.toc.content} />
)}
Expand Down
2 changes: 1 addition & 1 deletion src/app/(routes)/plura/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export default async function DocPage({ params }: { params: Promise<DocPageProps
</div>
</div>
<div className="hidden text-sm xl:block">
<div className="sticky top-16 -mt-10 h-[calc(100vh-3.5rem)] pt-4">
<div className="sticky top-8 h-[calc(100vh-3.5rem)] pt-4">
{doc.toc.visible && (
<DashboardTableOfContents toc={doc.toc.content} />
)}
Expand Down
8 changes: 8 additions & 0 deletions src/components/mdx/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import {
CardHeader,
CardTitle,
} from "@/components/ui/card"
import {
Avatar,
AvatarImage,
AvatarFallback
} from "@radix-ui/react-avatar";
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Files, File, Folder } from "@/components/ui/files";
Expand All @@ -27,6 +32,9 @@ import Link from "next/link";
import { CodeBlockWrapper } from "./code-block-wrapper";

export const mdxComponents = {
Avatar,
AvatarImage,
AvatarFallback,
Accordion,
AccordionContent,
AccordionItem,
Expand Down
14 changes: 11 additions & 3 deletions src/components/mdx/toc.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
"use client";

import * as React from "react";

import { cn } from "@/lib/utils";
import { useMounted } from "@/hooks/use-mounted";
import Newsletter from "../sidebar/newsletter";
import { MDXContentRenderer } from "./mdx-content-renderer";
import { contributors } from "#site/content";


interface TocEntry {
items?: TocEntry[];
Expand All @@ -17,6 +19,7 @@ interface TocProps {
}

export function DashboardTableOfContents({ toc }: TocProps) {

const itemIds = React.useMemo(
() =>
toc
Expand All @@ -32,8 +35,13 @@ export function DashboardTableOfContents({ toc }: TocProps) {
const mounted = useMounted();

return mounted ? (
<div className="h-[calc(100vh-3.5rem)] flex flex-col justify-between pb-10">
{/* Added a wrapper div with overflow styling */}
<div className="h-[calc(100vh-3.5rem)] flex flex-col justify-between">
{/* Add Contributos here */}

<div className="flex flex-col">
<MDXContentRenderer code={ contributors[0].body } />
</div>

<div className="space-y-2 overflow-y-auto pr-4 scrollbar-thin scrollbar-thumb-gray-300 scrollbar-track-transparent">
<p className="font-medium sticky top-0 bg-background pt-2 pb-2">On this page</p>
<div className="relative h-fit">
Expand Down
50 changes: 50 additions & 0 deletions src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
"use client"

import * as React from "react"
import * as AvatarPrimitive from "@radix-ui/react-avatar"

import { cn } from "@/lib/utils"

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)}
{...props}
/>
))
Avatar.displayName = AvatarPrimitive.Root.displayName

const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
))
AvatarImage.displayName = AvatarPrimitive.Image.displayName

const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
className
)}
{...props}
/>
))
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName

export { Avatar, AvatarImage, AvatarFallback }
1 change: 1 addition & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default {
"./src/pages/**/*.{js,ts,jsx,tsx,mdx}",
"./src/components/**/*.{js,ts,jsx,tsx,mdx}",
"./src/app/**/*.{js,ts,jsx,tsx,mdx}",
"./content/**/*.{mdx,md}",
],
theme: {
extend: {
Expand Down
11 changes: 10 additions & 1 deletion velite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ export const pluraAi = defineCollection({
.transform(computedFields),
});

export const contributors = defineCollection({
name: "Contributors",
pattern: "contributors/**/*.mdx",
schema: s
.object({
body: s.mdx(),
})
})

export default defineConfig({
root: "content",
output: {
Expand All @@ -83,7 +92,7 @@ export default defineConfig({
name: "[name]-[hash:6].[ext]",
clean: true,
},
collections: { guide, plura, pluraAi },
collections: { guide, plura, pluraAi, contributors },
mdx: {
rehypePlugins: [
rehypeSlug,
Expand Down