Skip to content

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

🐛 fix: Fix responsive styles and show video on mobile for docs

Dillion Verma1130924e6a88
diff --git a/app/(docs)/components/[slug]/page.tsx b/app/(docs)/components/[slug]/page.tsx
index 111d84bb..dcc1cbc3 100644
--- a/app/(docs)/components/[slug]/page.tsx
+++ b/app/(docs)/components/[slug]/page.tsx
@@ -156,7 +156,19 @@ export default async function Component({ params }: Props) {
</div>
<div className="flex flex-col pt-8 gap-4">
- <ComponentWrapper>
+ {component.video && (
+ <div className="flex md:hidden overflow-hidden relative rounded-xl border dark:border-slate-800 md:p-8 justify-center items-center flex-col max-w-[65ch]">
+ <video
+ src={component.video}
+ autoPlay
+ loop
+ muted
+ playsInline
+ className="relative -bottom-1 aspect-video" // needed because random black line at bottom of video
+ />
+ </div>
+ )}
+ <ComponentWrapper className={"hidden md:flex"}>
<MagicContainer
className={
"grid w-full lg:grid-cols-2 grid-cols-1 gap-4 min-h-[500px] lg:min-h-[300px] p-8"
diff --git a/app/(marketing)/page.tsx b/app/(marketing)/page.tsx
index e2ce0bf0..93e847c1 100644
--- a/app/(marketing)/page.tsx
+++ b/app/(marketing)/page.tsx
@@ -73,7 +73,7 @@ export default async function Home() {
className="z-10 flex flex-col items-center justify-center w-full h-full"
delay={0.3}
>
- <div className="space-x-4">
+ <div className="flex flex-col md:flex-row gap-4">
{user && (
<Link
href="/components"
diff --git a/components/component-wrapper.tsx b/components/component-wrapper.tsx
index f6b9bd8d..57889ce4 100644
--- a/components/component-wrapper.tsx
+++ b/components/component-wrapper.tsx
@@ -1,9 +1,20 @@
import { cn } from "@/lib/utils";
import { CSSProperties } from "react";
-const ComponentWrapper = ({ children }: { children: any }) => {
+const ComponentWrapper = ({
+ className,
+ children,
+}: {
+ className: string;
+ children: any;
+}) => {
return (
- <div className="relative rounded-xl border dark:border-slate-800 md:p-8 flex justify-center items-center flex-col max-w-[65ch]">
+ <div
+ className={cn(
+ "relative rounded-xl border dark:border-slate-800 md:p-8 flex justify-center items-center flex-col max-w-[65ch]",
+ className
+ )}
+ >
{children}
<div
diff --git a/components/magicui/magic-card.tsx b/components/magicui/magic-card.tsx
index add6955a..4a971fae 100644
--- a/components/magicui/magic-card.tsx
+++ b/components/magicui/magic-card.tsx
@@ -204,7 +204,7 @@ export function MagicCard({
background = `rgba(255,255,255,0.1)`,
}: MagicCardProps) {
const spotlightStyles =
- "before:pointer-events-none before:absolute before:w-full before:h-full before:rounded-[var(--border-radius)] before:top-0 before:left-0 before:duration-500 before:transition-opacity before:bg-[radial-gradient(var(--mask-size)_circle_at_var(--mouse-x)_var(--mouse-y),var(--spotlight-color),transparent_40%)] before:z-[3] before:blur-lg";
+ "before:pointer-events-none before:absolute before:w-full before:h-full before:rounded-[var(--border-radius)] before:top-0 before:left-0 before:duration-500 before:transition-opacity before:bg-[radial-gradient(var(--mask-size)_circle_at_var(--mouse-x)_var(--mouse-y),var(--spotlight-color),transparent_40%)] before:z-[3] before:blur-xs";
const borderStyles =
"after:pointer-events-none after:absolute after:w-full after:h-full after:rounded-[var(--border-radius)] after:top-0 after:left-0 after:duration-500 after:transition-opacity after:bg-[radial-gradient(var(--mask-size)_circle_at_var(--mouse-x)_var(--mouse-y),var(--border-color),transparent_40%)] after:z-[1]";
diff --git a/components/mdx-components.tsx b/components/mdx-components.tsx
index e2136c3a..f23f68dd 100644
--- a/components/mdx-components.tsx
+++ b/components/mdx-components.tsx
@@ -29,6 +29,32 @@ const components = {
a: CustomLink,
Image,
ComponentSource,
+ table: ({ className, ...props }: React.HTMLAttributes<HTMLTableElement>) => (
+ <div className="my-6 w-full overflow-y-auto">
+ <table className={cn("w-full", className)} {...props} />
+ </div>
+ ),
+ tr: ({ className, ...props }: React.HTMLAttributes<HTMLTableRowElement>) => (
+ <tr className={cn("m-0 border-t p-0", className)} {...props} />
+ ),
+ th: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (
+ <th
+ className={cn(
+ "border px-4 py-2 text-left font-bold [&[align=center]]:text-center [&[align=right]]:text-right",
+ className
+ )}
+ {...props}
+ />
+ ),
+ td: ({ className, ...props }: React.HTMLAttributes<HTMLTableCellElement>) => (
+ <td
+ className={cn(
+ "border px-4 py-2 text-left [&[align=center]]:text-center [&[align=right]]:text-right whitespace-pre",
+ className
+ )}
+ {...props}
+ />
+ ),
Step: ({ className, ...props }: React.ComponentProps<"h3">) => (
<div
className={cn(
@@ -109,7 +135,7 @@ export function Mdx({ code }: MDXProps) {
`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`
+ `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-xs md:prose-pre:text-sm prose-pre:tracking-tighter`
)}
>
{/* @ts-ignore */}
diff --git a/content/components/magic-card.mdx b/content/components/magic-card.mdx
index e1c2329f..fedc1159 100644
--- a/content/components/magic-card.mdx
+++ b/content/components/magic-card.mdx
@@ -4,7 +4,7 @@ date: 2023-06-25
summary: A spotlight effect that follows your mouse cursor and highlights borders on hover.
author: dillionverma
published: true
-video: https://cdn.magicuikit.com/magic-border.webm
+video: https://cdn.magicuikit.com/magic-card.webm
---
<Steps>
@@ -26,12 +26,12 @@ npm install -D tailwindcss tailwind-merge clsx
Copy and page the following code into your project.
```text
-components/magicui/magic-border.tsx
+components/magicui/magic-card.tsx
```
-<ComponentSource name="magic-border" >
+<ComponentSource name="magic-card" >
-```tsx showLineNumbers
+```tsx
"use client";
import clsx, { ClassValue } from "clsx";
diff --git a/package.json b/package.json
index 8858389b..4df74065 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,9 @@
"dev:stripe": "stripe listen --forward-to localhost:3003/api/webhooks/stripe",
"dev:migrate": "dotenv -e .env.local -- npx prisma db push",
"dev:reset": "dotenv -e .env.local -- npx prisma migrate reset",
- "dev:seed": "npx tsx prisma/seed.ts"
+ "dev:seed": "npx tsx prisma/seed.ts",
+ "prod:migrate": "dotenv -e .env -- npx prisma db push",
+ "prod:seed": "dotenv -e .env -- npx tsx prisma/seed.ts"
},
"dependencies": {
"@auth/prisma-adapter": "^1.0.0",