Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

🐛 fix: update docs not loading issue

Dillion Verma5d2ff98bf0bd
diff --git a/app/(docs)/components/[slug]/page.tsx b/app/(docs)/components/[slug]/page.tsx
index c1aaeaff..ee3a05cb 100644
--- a/app/(docs)/components/[slug]/page.tsx
+++ b/app/(docs)/components/[slug]/page.tsx
@@ -20,7 +20,7 @@ import Balancer from "react-wrap-balancer";
export async function generateStaticParams() {
return allComponents.map((component) => ({
- slug: component.slug,
+ slug: component.slugAsParams,
}));
}
@@ -30,7 +30,7 @@ export async function generateMetadata({
params: { slug: string };
}): Promise<Metadata | undefined> {
const component = allComponents.find(
- (component) => component.slug === params.slug
+ (component) => component.slugAsParams === params.slug
);
if (!component) {
return;
@@ -76,7 +76,7 @@ export async function generateMetadata({
export default async function Post({ params }: { params: { slug: string } }) {
const component = allComponents.find(
- (component) => component.slug === params.slug
+ (component) => component.slugAsParams === params.slug
);
if (!component) {
notFound();
@@ -116,7 +116,7 @@ export default async function Post({ params }: { params: { slug: string } }) {
<div className="mt-4 flex items-center justify-between">
<div className="flex items-center space-x-6">
<Link
- href={`https://twitter.com/intent/tweet?text=${component.title}&url=https://magicuikit.com/components/${component.slug}&via=${component.author}`}
+ href={`https://twitter.com/intent/tweet?text=${component.title}&url=https://magicuikit.com/components/${component.slugAsParams}&via=${component.author}`}
target="_blank"
rel="noopener noreferrer"
className="transition-all hover:scale-110"
@@ -125,7 +125,7 @@ export default async function Post({ params }: { params: { slug: string } }) {
</Link>
<Link
href={`
- http://www.linkedin.com/shareArticle?mini=true&url=https://magicuikit.com/components/${component.slug}`}
+ http://www.linkedin.com/shareArticle?mini=true&url=https://magicuikit.com/components/${component.slugAsParams}`}
target="_blank"
rel="noopener noreferrer"
className="transition-all hover:scale-110"
@@ -133,7 +133,7 @@ export default async function Post({ params }: { params: { slug: string } }) {
<LinkedIn className="h-6 w-6" />
</Link>
<Link
- href={`https://www.facebook.com/sharer/sharer.php?u=https://magicuikit.com/components/${component.slug}`}
+ href={`https://www.facebook.com/sharer/sharer.php?u=https://magicuikit.com/components/${component.slugAsParams}`}
target="_blank"
rel="noopener noreferrer"
className="transition-all hover:scale-110"
diff --git a/components/MDX.tsx b/components/MDX.tsx
deleted file mode 100644
index e80cd411..00000000
--- a/components/MDX.tsx
+++ /dev/null
@@ -1,119 +0,0 @@
-"use client";
-
-import { cn } from "@/lib/utils";
-import { useMDXComponent } from "next-contentlayer/hooks";
-import Image from "next/image";
-import Link from "next/link";
-import { ComponentSource } from "./component-source";
-import { CopyButton } from "./copy-button";
-
-const CustomLink = (props: any) => {
- const href = props.href;
-
- if (href.startsWith("/")) {
- return (
- <Link {...props} href={href}>
- {props.children}
- </Link>
- );
- }
-
- if (href.startsWith("#")) {
- return <a {...props} />;
- }
-
- return <a target="_blank" rel="noopener noreferrer" {...props} />;
-};
-
-const components = {
- a: CustomLink,
- Image,
- ComponentSource,
- Step: ({ className, ...props }: React.ComponentProps<"h3">) => (
- <h4
- className={cn(
- "font-heading mt-8 scroll-m-20 text-xl font-semibold tracking-tight",
- className
- )}
- {...props}
- />
- ),
- Steps: ({ ...props }) => (
- <div
- className="[&>h4]:step mb-12 ml-4 border-l pl-8 [counter-reset:step]"
- {...props}
- />
- ),
- pre: ({
- className,
- __rawString__,
- // __npmCommand__,
- // __pnpmCommand__,
- // __yarnCommand__,
- __withMeta__,
- __src__,
- // __event__,
- // __style__,
- ...props
- }: React.HTMLAttributes<HTMLPreElement> & {
- // __style__?: Style["name"]
- __rawString__?: string;
- __withMeta__?: boolean;
- __src__?: string;
- // __event__?: Event["name"]
- }) => {
- return (
- <>
- <pre
- className={cn(
- "mb-4 mt-6 max-h-[650px] overflow-x-auto rounded-lg border bg-zinc-950 py-4 dark:bg-zinc-900",
- className
- )}
- {...props}
- />
- {__rawString__ && (
- <CopyButton
- value={__rawString__}
- src={__src__}
- // event={__event__}
- className={cn("absolute right-4 top-4", __withMeta__ && "top-16")}
- />
- )}
- {/* {__npmCommand__ && __yarnCommand__ && __pnpmCommand__ && (
- <CopyNpmCommandButton
- commands={{
- __npmCommand__,
- __pnpmCommand__,
- __yarnCommand__,
- }}
- className={cn("absolute right-4 top-4", __withMeta__ && "top-16")}
- />
- )} */}
- </>
- );
- },
-};
-
-interface MDXProps {
- code: string;
-}
-
-export function MDX({ code }: MDXProps) {
- const Component = useMDXComponent(code);
-
- return (
- <article
- className={cn(
- `prose dark:prose-invert prose-gray leading-tighter tracking-tighter`,
- // `md:prose-lg lg:prose-xl`,
- `prose-a:transition-colors prose-a:duration-200 prose-a:ease-out`,
- `dark:prose-a:text-gray-200 prose-a:underline-offset-4 dark:hover:prose-a:text-gray-700 prose-a:font-semibold hover:prose-a:text-gray-400`,
- // `prose-pre:bg-gray-900 prose-pre:rounded-xl prose-pre:overflow-x-auto prose-pre:border prose-pre:px-0 `,
- `prose-pre:mb-4 prose-pre:mt-6 prose-pre:max-h-[650px] prose-pre:overflow-x-auto prose-pre:rounded-lg prose-pre:border prose-pre:bg-gray-900 prose-pre:py-4 prose-pre:dark:bg-gray-900 prose-pre:px-0 prose-pre:text-sm prose-pre:tracking-tighter`
- )}
- >
- {/* @ts-ignore */}
- <Component components={components} />
- </article>
- );
-}
diff --git a/components/main-nav.tsx b/components/main-nav.tsx
index 958cf796..30c8eb71 100644
--- a/components/main-nav.tsx
+++ b/components/main-nav.tsx
@@ -6,6 +6,7 @@ import { siteConfig } from "@/config/site";
import { cn } from "@/lib/utils";
import Link from "next/link";
import { usePathname } from "next/navigation";
+import { Badge } from "./ui/badge";
export function MainNav() {
const pathname = usePathname();
@@ -17,6 +18,7 @@ export function MainNav() {
<span className="hidden font-bold sm:inline-block">
{siteConfig.name}
</span>
+ <Badge variant="secondary">Beta</Badge>
</Link>
<nav className="flex items-center space-x-6 text-sm font-medium">
{docsConfig.mainNav.map((item) => (
diff --git a/components/mdx-components.tsx b/components/mdx-components.tsx
index e6e9e80f..e2136c3a 100644
--- a/components/mdx-components.tsx
+++ b/components/mdx-components.tsx
@@ -30,7 +30,7 @@ const components = {
Image,
ComponentSource,
Step: ({ className, ...props }: React.ComponentProps<"h3">) => (
- <h4
+ <div
className={cn(
"font-heading mt-8 scroll-m-20 text-xl font-semibold tracking-tight",
className
@@ -40,7 +40,7 @@ const components = {
),
Steps: ({ ...props }) => (
<div
- className="[&>h4]:step mb-12 ml-4 border-l pl-8 [counter-reset:step]"
+ className="[&>div]:step mb-12 ml-4 border-l pl-8 [counter-reset:step]"
{...props}
/>
),
diff --git a/config/docs.ts b/config/docs.ts
index cbfc5331..bbedcc0e 100644
--- a/config/docs.ts
+++ b/config/docs.ts
@@ -25,7 +25,7 @@ export const docsConfig: DocsConfig = {
.filter((post) => post.published)
.map((component) => ({
title: component.title,
- href: `/components/${component.slug}`,
+ href: `/components/${component.slugAsParams}`,
items: [],
})),
},
diff --git a/content/components/magic-border.mdx b/content/components/magic-border.mdx
index af9e9df3..2170cf22 100644
--- a/content/components/magic-border.mdx
+++ b/content/components/magic-border.mdx
@@ -3,7 +3,7 @@ title: Magic Border
date: 2023-06-25
summary: A spotlight effect that highlights element borders on hover.
author: dillionverma
-published: false
+published: true
video: https://cdn.magicuikit.com/magic-border.webm
---