diff --git a/docs/app/docs/[[...slug]]/page.tsx b/docs/app/docs/[[...slug]]/page.tsx index fa6e771d06..6bb97f1fc4 100644 --- a/docs/app/docs/[[...slug]]/page.tsx +++ b/docs/app/docs/[[...slug]]/page.tsx @@ -59,7 +59,7 @@ export default async function Page({ > {page.data.title} {!avoidLLMHeader.includes(page.data.title) && ( -
+
{props.children}
@@ -85,7 +85,7 @@ export default async function Page({ return ( ); }, @@ -94,9 +94,9 @@ export default async function Page({ }, pre: (props) => { return ( - +
-
+										
 											{props.children}
 										
diff --git a/docs/components/api-method-tabs.tsx b/docs/components/api-method-tabs.tsx new file mode 100644 index 0000000000..036bcee7d8 --- /dev/null +++ b/docs/components/api-method-tabs.tsx @@ -0,0 +1,98 @@ +"use client"; + +import * as React from "react"; + +import { cn } from "@/lib/utils"; + +const provider = React.createContext<{ + current: string | null; + setCurrent: (value: string | null) => void; +}>({ + current: null, + setCurrent: () => {}, +}); + +function ApiMethodTabs({ + className, + ...props +}: React.ComponentProps<"div"> & { defaultValue: string | null }) { + const [current, setCurrent] = React.useState( + props.defaultValue || null, + ); + return ( + +
+ + ); +} + +const useApiMethodTabs = () => { + return React.useContext(provider); +}; + +function ApiMethodTabsList({ + className, + ...props +}: React.ComponentProps<"div">) { + return ( +
+ ); +} + +function ApiMethodTabsTrigger({ + className, + ...props +}: React.ComponentProps<"button"> & { value: string }) { + const { setCurrent, current } = useApiMethodTabs(); + return ( +
- - + + {isServerOnly ? null : ( ) : null} -
+
{isServerOnly ? ( -
+
This is a server-only endpoint
) : null}
{!isServerOnly ? : null} - - + + {isClientOnly ? null : ( ) : null} -
+
{serverCodeBlock} {isClientOnly ? ( -
+
This is a client-only endpoint
) : null}
{!isClientOnly ? : null} - - + + ); }; @@ -328,7 +333,7 @@ function TypeTable({ if (!props.length) return null; return ( - +
Prop @@ -354,7 +359,7 @@ function TypeTable({ ) : null} -
+
{tsxifyBackticks(prop.description ?? "")}
@@ -709,8 +714,8 @@ function createServerBody({ function Note({ children }: { children: ReactNode }) { return ( -
- +
+ Notes

{children as any}