UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
feat: add showcase
Dillion Verma6427a8bee97f
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 5375053c..021b7796 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -6,15 +6,6 @@ Read the [example PR](https://github.com/magicuidesign/magicui/pull/12) to learnOnce done, open a pull request from your forked repo to the main repo [here](https://github.com/magicuidesign/magicui/compare).-- [Getting Started](#getting-started)- - [Fork and Clone the Repository](#fork-and-clone-the-repository)- - [Adding a New Component](#adding-a-new-component)- - [1. Add Sidebar Button Meta for Your Component](#1-add-sidebar-button-meta-for-your-component)- - [2. Create Your Component](#2-create-your-component)- - [3. Create a Basic Example Showcasing Your Component](#3-create-a-basic-example-showcasing-your-component)- - [4. Create MDX Page for Your Component](#4-create-mdx-page-for-your-component)- - [5. Add Registry Export](#5-add-registry-export)-## Getting Started### Fork and Clone the Repository@@ -61,89 +52,98 @@ Once done, open a pull request from your forked repo to the main repo [here](httTo add a new component to MagicUI, you will need to modify several files. Follow these steps:-### 1. Add Sidebar Button Meta for Your Component--**File:** `config/docs.ts`--Add metadata for your component in the sidebar navigation.--```typescript-// Add sidebar button meta for your component-{- title: "Example Component",- href: `/docs/components/example-component`,- items: [],- label: "New",-}-```--### 2. Create Your Component--**File:** `registry/components/magicui/example-component.tsx`+### 1. Create Component-Create the main component file.+Create the main component in `registry/components/magicui/example-component.tsx````typescript-// Create your component hereimport React from 'react'-const ExampleComponent = () => {+export default function ExampleComponent() {return (<div>This is your component.</div>)}--export default ExampleComponent;```-### 3. Create a Basic Example Showcasing Your Component--**File:** `registry/components/example/example-component-demo.tsx`+### 2. Create Component Demo-Provide a basic example to showcase your component.+Provide a basic example to showcase your component in `registry/components/example/example-component-demo.tsx````typescript-// Create a very basic example showcasing your componentimport ExampleComponent from '@/registry/components/magicui/example-component'-const ExampleComponentDemo = () => (- <div className="relative justify-center">+export default function ExampleComponentDemo() {+ return (+ <div className="relative justify-center"><ExampleComponent /></div>-)--export default ExampleComponentDemo;+ )+}```-### 4. Create MDX Page for Your Component+### 3. Update Sidebar-**File:** `content/docs/components/example-component.mdx`+Add your component to the sidebar in `config/docs.ts`-Create an MDX file for documenting your component.+```typescript+{+ title: "Example Component",+ href: `/docs/components/example-component`,+ items: [],+ label: "New",+}+```++### 4. Create docs++Create an MDX file for documenting your component in `content/docs/components/example-component.mdx`````md---title: Example Componentdate: 2024-06-01-description: Example component for demonstrating MagicUI integration-author: Bankkroll+description: Example component for Magic UI+author: magicuipublished: true---<ComponentPreview name="example-component-demo" />-<Steps>+## Installation-### Installation+<Tabs defaultValue="cli">-Copy and paste the following code into your project.+<TabsList>+ <TabsTrigger value="cli">CLI</TabsTrigger>+ <TabsTrigger value="manual">Manual</TabsTrigger>+</TabsList>+<TabsContent value="cli">-```text-components/magicui/example-component.tsx+```bash+npx magicui-cli add example-component```+</TabsContent>++<TabsContent value="manual">++<Steps>++<Step>Copy and paste the following code into your project.</Step>++<ComponentSource name="example-component" />++<Step>Update the import paths to match your project setup.</Step>++</Steps>++</TabsContent>++</Tabs>+<ComponentSource name="example-component" /></Steps>@@ -153,21 +153,14 @@ components/magicui/example-component.tsx| Prop | Type | Description | Default || ----- | ------ | -------------------------- | ------- || color | String | The color of the component | "blue" |--## Credits--- Credit to [Bankk](https://www.x.com/bankkroll_eth)````-### 5. Add Registry Export--**File:** `registry/index.tsx`+### 5. Update Registry-Export your component and example in the registry.+Export your component and example in the registry in `registry/index.tsx````typescriptconst ui: Registry = {- // other components"example-component": {name: "example-component",type: "components:ui",@@ -176,7 +169,6 @@ const ui: Registry = {};const example: Registry = {- // other examples"example-component-demo": {name: "example-component",type: "components:example",@@ -188,48 +180,49 @@ const example: Registry = {};```-## How to use CLI+## Adding to the showcase-1. Run CLI script from project `root` folder+## 1. Create your showcase as a MDX file-```bash-pnpm run install:cli-```+Create your showcase in `content/showcase/website-name.mdx`-```bash-pnpm run dev:cli+```mdx+---+title: website-name.com+description: Website description+image: /showcase/website-name.png+href: https://website-name.com+featured: true+affiliation: YC S25, raised $10M+---```-```bash-pnpm run build:cli-```+## 2. Create an image-```bash-pnpm run release:cli-```+Upload an image of your site to `public/showcase/website-name.png`-2. Run CLI script from `/packages/cli` folder+## How to use CLI++1. Run CLI script from project `root` folder```bash-pnpm run install+pnpm run install:cli``````bash-pnpm run dev+pnpm run dev:cli``````bash-pnpm run build+pnpm run build:cli``````bash-pnpm run release+pnpm run release:cli```-Lots more useful scripts are available in package.json-The CLI in development uses index.json from default `3000` port on localhost. Otherwise [https://magicui.design](https://magicui.design/registry/index.json)## Ask for Help-For any help or questions, please open a new GitHub issue and we will get back to you :)+For any help or questions, please open a new GitHub issue.diff --git a/app/(marketing)/page.tsx b/app/(marketing)/page.tsxindex 57f13cf5..961508de 100644--- a/app/(marketing)/page.tsx+++ b/app/(marketing)/page.tsx@@ -1,30 +1,15 @@-import Hero from "@/components/hero";-import { Mdx } from "@/components/mdx-components";--import "@/styles/mdx.css";--import { notFound } from "next/navigation";-import { allPages } from "contentlayer/generated";--import Testimonials from "@/components/testimonials";--const PAGE = "home";+import ComponentDemos from "@/components/sections/component-demos";+import Hero from "@/components/sections/hero";+import Showcase from "@/components/sections/showcase";+import Testimonials from "@/components/sections/testimonials";export default async function Home() {- const page = allPages.find((page) => page.slugAsParams === PAGE);-- if (!page) {- notFound();- }-return (<><Hero />- <section id="component-demos" className="container max-w-5xl">- <Mdx code={page.body.code} />- </section>+ <Showcase />+ <ComponentDemos /><Testimonials />- {/* <CTASection /> */}</>);}diff --git a/app/(marketing)/showcase/[...slug]/page.tsx b/app/(marketing)/showcase/[...slug]/page.tsxnew file mode 100644index 00000000..946deb53--- /dev/null+++ b/app/(marketing)/showcase/[...slug]/page.tsx@@ -0,0 +1,98 @@+import { Metadata } from "next";+import { notFound } from "next/navigation";+import { env } from "@/env.mjs";+import { allShowcases } from "contentlayer/generated";++import { siteConfig } from "@/config/site";+import { absoluteUrl } from "@/lib/utils";+import { ShowcaseCard } from "@/components/sections/showcase";++interface PageProps {+ params: {+ slug: string[];+ };+}++async function getPageFromParams(params: PageProps["params"]) {+ const slug = params?.slug?.join("/");+ const page = allShowcases.find((page) => page.slugAsParams === slug);++ if (!page) {+ null;+ }++ return page;+}++export async function generateMetadata({+ params,+}: PageProps): Promise<Metadata> {+ const page = await getPageFromParams(params);++ if (!page) {+ return {};+ }++ const url = env.NEXT_PUBLIC_APP_URL;++ const ogUrl = new URL(`${url}/api/og`);+ ogUrl.searchParams.set("heading", page.title);+ ogUrl.searchParams.set("type", siteConfig.name);+ ogUrl.searchParams.set("mode", "light");++ return {+ title: page.title,+ description: page.description,+ openGraph: {+ title: page.title,+ description: page.description,+ type: "article",+ url: absoluteUrl(page.slug),+ images: [+ {+ url: ogUrl.toString(),+ width: 1200,+ height: 630,+ alt: page.title,+ },+ ],+ },+ twitter: {+ card: "summary_large_image",+ title: page.title,+ description: page.description,+ images: [ogUrl.toString()],+ },+ };+}++export async function generateStaticParams(): Promise<PageProps["params"][]> {+ return allShowcases.map((page) => ({+ slug: page.slugAsParams.split("/"),+ }));+}++export default async function PagePage({ params }: PageProps) {+ const page = await getPageFromParams(params);++ if (!page) {+ notFound();+ }++ return (+ <article className="container py-14 max-w-2xl">+ <h2 className="mb-4 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">+ {page.title}+ </h2>+ <h3 className="mx-auto mb-8 text-balance text-center text-lg font-medium tracking-tight text-foreground/80">+ {page.title} uses Magic UI to build their landing page.+ </h3>+ <ShowcaseCard+ title={page.title}+ href={page.href}+ image={page.image}+ affiliation={page.affiliation}+ />+ </article>+ );+}diff --git a/app/(marketing)/showcase/page.tsx b/app/(marketing)/showcase/page.tsxnew file mode 100644index 00000000..6149af61--- /dev/null+++ b/app/(marketing)/showcase/page.tsx@@ -0,0 +1,24 @@+import { allShowcases } from "contentlayer/generated";++import { ShowcaseCard } from "@/components/sections/showcase";+import BlurFade from "@/registry/components/magicui/blur-fade";++export default async function Page() {+ return (+ <article className="container py-14 max-w-[120ch]">+ <h2 className="mb-2 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">+ Showcase+ </h2>+ <h3 className="mx-auto mb-8 text-balance text-center text-lg font-medium tracking-tight text-foreground/80">+ Companies choose Magic UI to build their landing pages.+ </h3>+ <div className="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3">+ {allShowcases.map((showcase, idx) => (+ <BlurFade key={idx} delay={0.25 + idx * 0.05}>+ <ShowcaseCard {...showcase} href={showcase.slug} />+ </BlurFade>+ ))}+ </div>+ </article>+ );+}diff --git a/components/sections/component-demos.tsx b/components/sections/component-demos.tsxnew file mode 100644index 00000000..3f6a654f--- /dev/null+++ b/components/sections/component-demos.tsx@@ -0,0 +1,29 @@+import { Mdx } from "@/components/mdx-components";++import "@/styles/mdx.css";++import { notFound } from "next/navigation";+import { allPages } from "contentlayer/generated";++const PAGE = "home";++export default function ComponentDemos() {+ const page = allPages.find((page) => page.slugAsParams === PAGE);++ if (!page) {+ notFound();+ }++ return (+ <section id="component-demos" className="container py-14 max-w-5xl">+ <h2 className="mb-2 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">+ Component Demos+ </h2>+ <h3 className="mx-auto mb-8 text-balance text-center text-lg font-medium tracking-tight text-foreground/80">+ Here are some of the components that you can use to build your landing+ pages.+ </h3>+ <Mdx code={page.body.code} />+ </section>+ );+}diff --git a/components/cta-section.tsx b/components/sections/cta.tsxsimilarity index 100%rename from components/cta-section.tsxrename to components/sections/cta.tsxdiff --git a/components/hero-client.tsx b/components/sections/hero-client.tsxsimilarity index 98%rename from components/hero-client.tsxrename to components/sections/hero-client.tsxindex bee0ba7d..fccc53ec 100644--- a/components/hero-client.tsx+++ b/components/sections/hero-client.tsx@@ -62,6 +62,7 @@ export default function HeroClient({ post }: { post: Doc }) {<b>Framer Motion</b>.<br />+ Perfect companion for <b>shadcn/ui</b>.</p><div className="mx-0 flex w-full max-w-full flex-col gap-4 py-1 sm:max-w-lg sm:flex-row md:mx-auto">@@ -99,7 +100,7 @@ export default function HeroClient({ post }: { post: Doc }) {</div></div>- <div className="relative mx-auto flex w-full max-w-48 items-center justify-center">+ <div className="relative mx-auto flex w-full max-w-56 items-center justify-center"><TechStackclassName="mx-auto flex w-full items-center justify-between"technologies={[@@ -108,7 +109,7 @@ export default function HeroClient({ post }: { post: Doc }) {"typescript","tailwindcss","framermotion",- // "shadcn",+ "shadcn",]}/></div>diff --git a/components/hero.tsx b/components/sections/hero.tsxsimilarity index 91%rename from components/hero.tsxrename to components/sections/hero.tsxindex a08c0111..1bd39fe9 100644--- a/components/hero.tsx+++ b/components/sections/hero.tsx@@ -1,7 +1,7 @@import { allDocs } from "@/.contentlayer/generated";import { compareDesc } from "date-fns";-import HeroClient from "@/components/hero-client";+import HeroClient from "@/components/sections/hero-client";export default async function Hero() {const post = allDocsdiff --git a/components/sections/showcase.tsx b/components/sections/showcase.tsxnew file mode 100644index 00000000..8e09a5d9--- /dev/null+++ b/components/sections/showcase.tsx@@ -0,0 +1,64 @@+import Image from "next/image";+import Link from "next/link";+import { allShowcases } from "@/.contentlayer/generated";+import { ChevronRightIcon } from "@radix-ui/react-icons";++import Marquee from "@/registry/components/magicui/marquee";++export interface ShowcaseCardProps {+ title: string;+ image: string;+ href: string;+ affiliation?: string;+}+export function ShowcaseCard({+ title,+ image,+ href,+ affiliation,+}: ShowcaseCardProps) {+ return (+ <Link+ href={href}+ className="flex flex-col gap-2 group relative overflow-hidden cursor-pointer"+ >+ <Image+ src={image}+ alt={title}+ width={500}+ height={300}+ className="size-full object-cover max-h-[300px] rounded-xl"+ />++ <div className="flex flex-col">+ <div className="group inline-flex cursor-pointer items-center justify-start gap-1 duration-200 hover:text-neutral-700 dark:hover:text-neutral-200 text-xl font-semibold text-neutral-700 dark:text-neutral-300">+ {title}+ <ChevronRightIcon className="size-4 translate-x-0 opacity-0 transition-all duration-300 ease-out group-hover:translate-x-1 group-hover:opacity-100" />+ </div>+ <p className="text-neutral-400 text-sm">{affiliation}</p>+ </div>+ </Link>+ );+}++export default async function Showcase() {+ return (+ <section id="showcase" className="container py-14">+ <h2 className="mb-2 text-center text-5xl font-bold leading-[1.2] tracking-tighter text-foreground">+ Showcase+ </h2>+ <h3 className="mx-auto mb-8 text-balance text-center text-lg font-medium tracking-tight text-foreground/80">+ Companies choose Magic UI to build their landing pages.+ </h3>+ <div className="relative flex flex-col">+ <Marquee className="max-w-screen [--duration:40s]">+ {allShowcases.map((showcase, idx) => (+ <ShowcaseCard key={idx} {...showcase} href={showcase.slug} />+ ))}+ </Marquee>+ <div className="pointer-events-none absolute inset-y-0 left-0 h-full w-1/12 bg-gradient-to-r from-background"></div>+ <div className="pointer-events-none absolute inset-y-0 right-0 h-full w-1/12 bg-gradient-to-l from-background"></div>+ </div>+ </section>+ );+}diff --git a/components/testimonials.tsx b/components/sections/testimonials.tsxsimilarity index 100%rename from components/testimonials.tsxrename to components/sections/testimonials.tsxdiff --git a/config/docs.ts b/config/docs.tsindex 3d24a71b..db704656 100644--- a/config/docs.ts+++ b/config/docs.ts@@ -11,6 +11,10 @@ export const docsConfig: DocsConfig = {title: "Components",href: "/components",},+ {+ title: "Showcase",+ href: "/showcase",+ },{title: "Templates",href: "https://pro.magicui.design",@@ -93,6 +97,11 @@ export const docsConfig: DocsConfig = {{title: "Landing Page Components",items: [+ {+ title: "Marquee",+ href: `/docs/components/marquee`,+ items: [],+ },{title: "Bento Grid",href: `/docs/components/bento-grid`,@@ -103,11 +112,6 @@ export const docsConfig: DocsConfig = {href: `/docs/components/animated-list`,items: [],},- {- title: "Marquee",- href: `/docs/components/marquee`,- items: [],- },{title: "Dock",href: `/docs/components/dock`,diff --git a/content/showcase/cognosys.mdx b/content/showcase/cognosys.mdxnew file mode 100644index 00000000..28a15aa3--- /dev/null+++ b/content/showcase/cognosys.mdx@@ -0,0 +1,9 @@+---+title: cognosys.ai+description: Cognosys is a platform for building and deploying AI agents+image: /showcase/cognosys.png+href: https://cognosys.ai+featured: true+author: "@cognosysai"+affiliation: Backed by Google Ventures, raised $2M+---diff --git a/content/showcase/infisical.mdx b/content/showcase/infisical.mdxnew file mode 100644index 00000000..9afca896--- /dev/null+++ b/content/showcase/infisical.mdx@@ -0,0 +1,8 @@+---+title: infisical.com+description: Infisical is a platform for managing secrets.+image: /showcase/infisical.png+href: https://infisical.com+featured: true+affiliation: YC W23, raised $2.8M+---diff --git a/content/showcase/langfuse.mdx b/content/showcase/langfuse.mdxnew file mode 100644index 00000000..fc343ca7--- /dev/null+++ b/content/showcase/langfuse.mdx@@ -0,0 +1,8 @@+---+title: langfuse.com+description: Open Source LLM Engineering Platform+image: /showcase/langfuse.png+href: https://langfuse.com+featured: true+affiliation: YC W23, raised $4M+---diff --git a/content/showcase/llmreport.mdx b/content/showcase/llmreport.mdxnew file mode 100644index 00000000..809655cb--- /dev/null+++ b/content/showcase/llmreport.mdx@@ -0,0 +1,8 @@+---+title: llm.report+description: LLM Report is an LLM observability platform+image: /showcase/llmreport.png+href: https://llm.report+featured: true+affiliation: Vercel AI Accelerator 2023, won $120k+---diff --git a/content/showcase/million.mdx b/content/showcase/million.mdxnew file mode 100644index 00000000..5b2e28f5--- /dev/null+++ b/content/showcase/million.mdx@@ -0,0 +1,8 @@+---+title: million.dev+description: Million.dev makes websites fast.+image: /showcase/million.png+href: https://million.dev+featured: true+affiliation: YC W24+---diff --git a/content/showcase/unriddle.mdx b/content/showcase/unriddle.mdxnew file mode 100644index 00000000..da1063d2--- /dev/null+++ b/content/showcase/unriddle.mdx@@ -0,0 +1,8 @@+---+title: unriddle.ai+description: Unriddle.ai is part of buildspace sf1, pioneer, and YC S24+image: /showcase/unriddle.png+href: https://unriddle.ai+featured: true+affiliation: YC S24+---diff --git a/contentlayer.config.ts b/contentlayer.config.tsindex bd38dfe7..b5b9e841 100644--- a/contentlayer.config.ts+++ b/contentlayer.config.ts@@ -53,6 +53,72 @@ const computedFields = {},};+export const Showcase = defineDocumentType(() => ({+ name: "Showcase",+ filePathPattern: `showcase/**/*.mdx`,+ contentType: "mdx",+ fields: {+ title: {+ type: "string",+ required: true,+ },+ author: {+ type: "string",+ required: false,+ },+ description: {+ type: "string",+ },+ image: {+ type: "string",+ required: true,+ },+ href: {+ type: "string",+ required: true,+ },+ affiliation: {+ type: "string",+ required: true,+ },+ featured: {+ type: "boolean",+ default: false,+ required: false,+ },+ },+ computedFields: {+ slug: {+ type: "string",+ resolve: (doc: any) => `/${doc._raw.flattenedPath}`,+ },+ slugAsParams: {+ type: "string",+ resolve: (doc: any) =>+ doc._raw.flattenedPath.split("/").slice(1).join("/"),+ },+ structuredData: {+ type: "json",+ resolve: (doc: any) =>+ ({+ "@context": "https://schema.org",+ "@type": `BlogPosting`,+ headline: doc.title,+ datePublished: doc.date,+ dateModified: doc.date,+ description: doc.summary,+ image: doc.image,+ url: `https://magicui.design/${doc._raw.flattenedPath}`,+ author: {+ "@type": "Person",+ name: doc.author,+ url: `https://twitter.com/${doc.author}`,+ },+ }) as WithContext<BlogPosting>,+ },+ },+}));+export const Page = defineDocumentType(() => ({name: "Page",filePathPattern: `pages/**/*.mdx`,@@ -119,7 +185,7 @@ export const Doc = defineDocumentType(() => ({export default makeSource({contentDirPath: "./content",- documentTypes: [Page, Doc],+ documentTypes: [Page, Doc, Showcase],mdx: {remarkPlugins: [remarkGfm],rehypePlugins: [diff --git a/public/showcase/cognosys.png b/public/showcase/cognosys.pngnew file mode 100644index 00000000..8d07fc4eBinary files /dev/null and b/public/showcase/cognosys.png differdiff --git a/public/showcase/infisical.png b/public/showcase/infisical.pngnew file mode 100644index 00000000..fff22272Binary files /dev/null and b/public/showcase/infisical.png differdiff --git a/public/showcase/langfuse.png b/public/showcase/langfuse.pngnew file mode 100644index 00000000..4726c7b1Binary files /dev/null and b/public/showcase/langfuse.png differdiff --git a/public/showcase/llmreport.png b/public/showcase/llmreport.pngnew file mode 100644index 00000000..dfa637b2Binary files /dev/null and b/public/showcase/llmreport.png differdiff --git a/public/showcase/million.png b/public/showcase/million.pngnew file mode 100644index 00000000..7b9896aeBinary files /dev/null and b/public/showcase/million.png differdiff --git a/public/showcase/unriddle.png b/public/showcase/unriddle.pngnew file mode 100644index 00000000..4b3bb5beBinary files /dev/null and b/public/showcase/unriddle.png differ