UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
docs: Improve ComponentSource title usage in docs (#956)
Lin Hugo3a90841b07d7
diff --git a/apps/www/components/component-source.tsx b/apps/www/components/component-source.tsxindex 33b0f738..ef907352 100644--- a/apps/www/components/component-source.tsx+++ b/apps/www/components/component-source.tsx@@ -12,17 +12,21 @@ import { getIconForLanguageExtension } from "@/components/icons"export async function ComponentSource({name,src,- title,language,collapsible = true,className,}: React.ComponentProps<"div"> & {name?: stringsrc?: string- title?: stringlanguage?: stringcollapsible?: boolean}) {+ const resolvedTitle = name+ ? `components/ui/${name}.tsx`+ : src+ ? src+ : undefined+if (!name && !src) {return null}@@ -43,7 +47,7 @@ export async function ComponentSource({return null}- const lang = language ?? title?.split(".").pop() ?? "tsx"+ const lang = language ?? resolvedTitle?.split(".").pop() ?? "tsx"const highlightedCode = await highlightCode(code, lang)if (!collapsible) {@@ -52,7 +56,7 @@ export async function ComponentSource({code={code}highlightedCode={highlightedCode}language={lang}- title={title}+ title={resolvedTitle}/>)}@@ -63,7 +67,7 @@ export async function ComponentSource({code={code}highlightedCode={highlightedCode}language={lang}- title={title}+ title={resolvedTitle}/></CodeCollapsibleWrapper>)diff --git a/apps/www/content/docs/components/marquee.mdx b/apps/www/content/docs/components/marquee.mdxindex bbdf6552..5f374b56 100644--- a/apps/www/content/docs/components/marquee.mdx+++ b/apps/www/content/docs/components/marquee.mdx@@ -31,7 +31,7 @@ npx shadcn@latest add @magicui/marquee<Step>Copy and paste the following code into your project.</Step>-<ComponentSource name="marquee" title="components/ui/marquee.tsx" />+<ComponentSource name="marquee" /><Step>Update the import paths to match your project setup.</Step>