-
Notifications
You must be signed in to change notification settings - Fork 99
feat(cloud): port majority of mdx components without code-block #1859
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
Merged
sourishkrout
merged 2 commits into
v2
from
feat_cloud_port_majority_of_mdx_components_without_code-block
Jan 13, 2026
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,61 @@ | ||
| import { useState } from "react"; | ||
| import { Button } from "@/app/components/ui/button"; | ||
| import { Clipboard, Check } from "lucide-react"; | ||
| // import analyticsManager from "@/app/lib/services/analytics"; | ||
|
|
||
| interface CopyMarkdownButtonProps { | ||
| content: string; | ||
| itemId: string; | ||
| contentType: "blog_markdown" | "document_markdown"; | ||
| className?: string; | ||
| } | ||
|
|
||
| export function CopyMarkdownButton({ | ||
| content, | ||
| className = "", | ||
| }: CopyMarkdownButtonProps) { | ||
| const [isCopied, setIsCopied] = useState(false); | ||
|
|
||
| const handleCopy = () => { | ||
| if (!content) return; | ||
|
|
||
| navigator.clipboard | ||
| .writeText(content) | ||
| .then(() => { | ||
| setIsCopied(true); | ||
| setTimeout(() => { | ||
| setIsCopied(false); | ||
| }, 2000); | ||
|
|
||
| // analyticsManager.trackCopyEvent({ | ||
| // contentType, | ||
| // itemId, | ||
| // }); | ||
| }) | ||
| .catch((err) => { | ||
| console.error("Failed to copy content: ", err); | ||
| }); | ||
| }; | ||
|
|
||
| return ( | ||
| <Button | ||
| variant="outline" | ||
| size="sm" | ||
| onClick={handleCopy} | ||
| disabled={isCopied} | ||
| className={`w-full ${className}`} | ||
| > | ||
| {isCopied ? ( | ||
| <> | ||
| <Check className="mr-1 h-4 w-4" /> | ||
| Copied! | ||
| </> | ||
| ) : ( | ||
| <> | ||
| <Clipboard className="mr-1 h-4 w-4" /> | ||
| Copy as Markdown | ||
| </> | ||
| )} | ||
| </Button> | ||
| ); | ||
| } | ||
This file contains hidden or 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,16 @@ | ||
| import React from "react"; | ||
|
|
||
| /** | ||
| * Component to display an API function/method signature | ||
| */ | ||
| export default function ApiSignature({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode; | ||
| }) { | ||
| return ( | ||
| <div className="api-signature bg-muted my-4 overflow-x-auto rounded-md p-3 font-mono"> | ||
sourishkrout marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| {children} | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or 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,33 @@ | ||
| /** | ||
| * Component to display the API object type within headings | ||
| * | ||
| * Renders the type as a colored label and stores metadata for documentation linking. | ||
| */ | ||
| export interface ApiTypeProps { | ||
| /** The type of API object (Module, Class, Function, Alias, Attribute) */ | ||
| type: string; | ||
| /** The path to the document (e.g., "core/anthropic/call_params") */ | ||
| path: string; | ||
| /** The name of the symbol (e.g., "AnthropicCallParams") */ | ||
| symbolName: string; | ||
| /** The slug for this API object (used for heading IDs) */ | ||
| slug: string; | ||
| } | ||
|
|
||
| export default function ApiType({ | ||
| type, | ||
| path, | ||
| symbolName, | ||
| slug, | ||
| }: ApiTypeProps) { | ||
| return ( | ||
| <span | ||
| className="text-card-foreground bg-card mr-2 rounded-md px-2 py-1 align-middle text-sm font-medium" | ||
| data-path={path} | ||
| data-symbol={symbolName} | ||
| data-slug={slug} | ||
| > | ||
| {type} | ||
| </span> | ||
| ); | ||
| } |
This file contains hidden or 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,53 @@ | ||
| import { type TypeInfo, TypeLink } from "./type-link"; | ||
|
|
||
| export type Attribute = { | ||
| name: string; | ||
| type_info: TypeInfo; | ||
| description?: string; | ||
| }; | ||
|
|
||
| interface AttributesTableProps { | ||
| attributes: Attribute[]; | ||
| } | ||
|
|
||
| /** | ||
| * Component to display a table of class attributes | ||
| */ | ||
| export default function AttributesTable({ attributes }: AttributesTableProps) { | ||
| if (!attributes || attributes.length === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="api-attributes my-6"> | ||
| <h3 className="mb-2 text-lg font-semibold">Attributes</h3> | ||
| <div className="overflow-x-auto rounded-md border"> | ||
| <table className="w-full border-collapse"> | ||
| <thead className="bg-muted"> | ||
| <tr> | ||
| <th className="border-b px-4 py-2 text-left">Name</th> | ||
| <th className="border-b px-4 py-2 text-left">Type</th> | ||
| <th className="border-b px-4 py-2 text-left">Description</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {attributes.map((attr, index) => ( | ||
| <tr | ||
| key={index} | ||
| className={index % 2 === 0 ? "bg-background" : "bg-muted/20"} | ||
| > | ||
| <td className="border-b px-4 py-2 font-mono">{attr.name}</td> | ||
| <td className="border-b px-4 py-2"> | ||
| <TypeLink type={attr.type_info} /> | ||
| </td> | ||
| <td className="border-b px-4 py-2"> | ||
| {attr.description || "-"} | ||
| </td> | ||
| </tr> | ||
| ))} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,61 @@ | ||
| import { type TypeInfo, TypeLink } from "./type-link"; | ||
|
|
||
| export type Parameter = { | ||
| name: string; | ||
| type_info: TypeInfo; | ||
| description?: string; | ||
| default?: string; | ||
| }; | ||
|
|
||
| interface ParametersTableProps { | ||
| parameters: Parameter[]; | ||
| } | ||
|
|
||
| /** | ||
| * Component to display a table of parameters with their types | ||
| */ | ||
| export default function ParametersTable({ parameters }: ParametersTableProps) { | ||
| if (!parameters || parameters.length === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="api-parameters my-6"> | ||
| <h3 className="mb-2 text-lg font-semibold">Parameters</h3> | ||
| <div className="overflow-x-auto rounded-md border"> | ||
| <table className="w-full border-collapse"> | ||
| <thead className="bg-muted"> | ||
| <tr> | ||
| <th className="border-b px-4 py-2 text-left">Name</th> | ||
| <th className="border-b px-4 py-2 text-left">Type</th> | ||
| <th className="border-b px-4 py-2 text-left">Description</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| {parameters.map((param, index) => ( | ||
| <tr | ||
| key={index} | ||
| className={index % 2 === 0 ? "bg-background" : "bg-muted/20"} | ||
| > | ||
| <td className="border-b px-4 py-2 font-mono"> | ||
| {param.name} | ||
| {param.default && ( | ||
| <span className="text-muted-foreground ml-2"> | ||
| = {param.default} | ||
| </span> | ||
| )} | ||
| </td> | ||
| <td className="border-b px-4 py-2"> | ||
| <TypeLink type={param.type_info} /> | ||
| </td> | ||
| <td className="border-b px-4 py-2"> | ||
| {param.description || "-"} | ||
| </td> | ||
| </tr> | ||
| ))} | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or 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,54 @@ | ||
| import { type TypeInfo, TypeLink } from "./type-link"; | ||
|
|
||
| export type ReturnTypeInfo = { | ||
| name?: string; | ||
| type_info: TypeInfo; | ||
| description?: string; | ||
| }; | ||
|
|
||
| interface ReturnTableProps { | ||
| returnType: ReturnTypeInfo; | ||
| } | ||
|
|
||
| /** | ||
| * Component to display a function's return type in a table format consistent with other tables | ||
| */ | ||
| export default function ReturnTable({ returnType }: ReturnTableProps) { | ||
| if (!returnType || !returnType.type_info) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <div className="api-return-type my-6"> | ||
| <h3 className="mb-2 text-lg font-semibold">Returns</h3> | ||
| <div className="overflow-x-auto rounded-md border"> | ||
| <table className="w-full border-collapse"> | ||
| <thead className="bg-muted"> | ||
| <tr> | ||
| {returnType.name && ( | ||
| <th className="border-b px-4 py-2 text-left">Name</th> | ||
| )} | ||
| <th className="border-b px-4 py-2 text-left">Type</th> | ||
| <th className="border-b px-4 py-2 text-left">Description</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr className="bg-background"> | ||
| {returnType.name && ( | ||
| <td className="border-b px-4 py-2 font-mono"> | ||
| {returnType.name} | ||
| </td> | ||
| )} | ||
| <td className="border-b px-4 py-2"> | ||
| <TypeLink type={returnType.type_info} /> | ||
| </td> | ||
| <td className="border-b px-4 py-2"> | ||
| {returnType.description || "-"} | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.