UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
🐛 fix: create vertical marquee, update landing page with reviews
Dillion Verma47d69c6deaa2
diff --git a/components/landing/hero.tsx b/components/landing/hero.tsxindex 6d350e51..ddbd04b2 100644--- a/components/landing/hero.tsx+++ b/components/landing/hero.tsx@@ -1,16 +1,25 @@import { buttonVariants } from "@/components/ui/button";import { Separator } from "@/components/ui/separator";+import { db } from "@/lib/db";import { cn } from "@/lib/utils";import FadeIn from "@/registry/components/magicui/fade-in";+import NumberTicker from "@/registry/components/magicui/number-ticker";+import { StarFilledIcon } from "@radix-ui/react-icons";import { ChevronRight } from "lucide-react";import Link from "next/link";import { CSSProperties } from "react";-export default function Hero() {+export default async function Hero() {+ const payments = await db.payment.count({+ where: {+ status: "succeeded",+ },+ });+return (<section className="space-y-6 pb-8 pt-20 md:pb-12"><div className="container flex max-w-[64rem] flex-col items-center gap-4 text-center">- <FadeIn className="z-10 flex h-full w-full flex-col items-center justify-center">+ <FadeIn><Linkhref="/components/retro-grid"className={cn(@@ -43,26 +52,19 @@ export default function Hero() {</Link></FadeIn><FadeIn- // delay={0.0}- className="z-10 flex h-full w-full flex-col items-center justify-center"+ // delay={0.0}>- <h1 className="text-5xl font-medium tracking-tight sm:text-6xl md:text-7xl lg:text-8xl">- Create Magical <br /> Landing Pages <br /> in Minutes+ <h1 className="text-5xl font-bold tracking-tighter sm:text-6xl md:text-7xl lg:text-8xl">+ Create Magical <br /> Landing Pages <br /></h1></FadeIn>- <FadeIn- className="z-10 flex h-full w-full flex-col items-center justify-center"- delay={0.1}- >- <p className="max-w-[42rem] leading-normal text-muted-foreground sm:text-xl sm:leading-8">+ <FadeIn delay={0.1}>+ <p className="text-sm leading-normal text-muted-foreground sm:text-xl">Magic UI is a curated collection of React + Tailwind CSS + FramerMotion components</p></FadeIn>- <FadeIn- className="z-10 flex h-full w-full flex-col items-center justify-center"- delay={0.2}- >+ <FadeIn delay={0.2}><div className="flex flex-col gap-4 md:flex-row"><Linkhref="/pricing"@@ -70,7 +72,7 @@ export default function Hero() {buttonVariants({size: "lg",}),- "hidden gap-2 whitespace-pre md:flex",+ "gap-2 whitespace-pre md:flex","group relative w-full gap-1 overflow-hidden rounded-sm text-sm font-semibold tracking-tighter","transform-gpu rounded-sm ring-offset-current transition-all duration-300 ease-out hover:ring-2 hover:ring-primary hover:ring-offset-2",)}@@ -84,7 +86,7 @@ export default function Hero() {variant: "outline",size: "lg",}),- "hidden gap-2 whitespace-pre md:flex",+ "gap-2 whitespace-pre md:flex","group relative w-full gap-1 overflow-hidden rounded-sm text-sm font-semibold tracking-tighter",)}>@@ -93,6 +95,25 @@ export default function Hero() {</div></FadeIn></div>+ <FadeIn delay={0.3}>+ <div className="container flex flex-col items-center justify-center sm:flex-row">+ <div className="flex flex-row">+ <StarFilledIcon className="h-4 w-4 text-yellow-300" />+ <StarFilledIcon className="h-4 w-4 text-yellow-300" />+ <StarFilledIcon className="h-4 w-4 text-yellow-300" />+ <StarFilledIcon className="h-4 w-4 text-yellow-300" />+ <StarFilledIcon className="h-4 w-4 text-yellow-300" />+ </div>++ <span className="mx-1.5 hidden h-1 w-1 rounded-full bg-gray-500 dark:bg-gray-400 sm:block" />++ <span className="inline-block text-center text-xs font-medium leading-snug tracking-tighter">+ Used by{" "}+ <NumberTicker value={payments} className="font-bold" delay={0.2} />{" "}+ developers to make beautiful landing pages+ </span>+ </div>+ </FadeIn></section>);}diff --git a/components/landing/testimonials.tsx b/components/landing/testimonials.tsxindex 1795c3f7..6d8ec69b 100644--- a/components/landing/testimonials.tsx+++ b/components/landing/testimonials.tsx@@ -32,7 +32,10 @@ export default async function Testimonials() {const secondRow = tweets.slice(tweets.length / 2);return (- <section id="testimonials" className="flex flex-col gap-4 pb-8 pt-20">+ <section+ id="testimonials"+ className="relative flex flex-col gap-4 pb-8 pt-20"+ ><Marquee className="max-w-screen [--duration:120s]" pauseOnHover>{firstRow.map((id, idx) => (<FadeIn delay={0.06 + idx * 0.04} key={idx}>diff --git a/components/pricing/testimonials.tsx b/components/pricing/testimonials.tsxindex a03ee63f..f8c05cf3 100644--- a/components/pricing/testimonials.tsx+++ b/components/pricing/testimonials.tsx@@ -46,7 +46,7 @@ export default async function Testimonials() {<FadeIn delay={0.06 + idx * 0.04} key={idx}><TweetCardid={id}- className="max-h-32 w-72 min-w-[18rem] bg-background"+ className="max-h-32 w-72 min-w-[18rem] bg-background/60"/></FadeIn>))}@@ -60,7 +60,7 @@ export default async function Testimonials() {<FadeIn delay={0.06 + 0.04 * (secondRow.length - idx)} key={idx}><TweetCardid={id}- className="max-h-32 w-72 min-w-[18rem] bg-background"+ className="max-h-32 w-72 min-w-[18rem] bg-background/60"/></FadeIn>))}diff --git a/content/components/marquee.mdx b/content/components/marquee.mdxindex 9fc25b14..cb7fb042 100644--- a/content/components/marquee.mdx+++ b/content/components/marquee.mdx@@ -70,6 +70,10 @@ components/magicui/marquee.tsx## Examples+### Vertical++<ComponentPreview name="marquee-demo-vertical" />+### Logos<ComponentPreview name="marquee-logos" />@@ -81,4 +85,5 @@ components/magicui/marquee.tsx| className | string | | The class name to apply to the component. || reverse | boolean | false | Whether or not to reverse the direction of the marquee. || pauseOnHover | boolean | false | Whether or not to pause the marquee when the user hovers over the component. |+| vertical | boolean | false | Whether or not to display the marquee vertically. || children | node | | The content to display in the marquee. |diff --git a/registry/components/example/marquee-demo-vertical.tsx b/registry/components/example/marquee-demo-vertical.tsxnew file mode 100644index 00000000..7dcbbea4--- /dev/null+++ b/registry/components/example/marquee-demo-vertical.tsx@@ -0,0 +1,93 @@+import { cn } from "@/lib/utils";+import Marquee from "@/registry/components/magicui/marquee";++const reviews = [+ {+ name: "Jack",+ username: "@jack",+ body: "I've never seen anything like this before. It's amazing. I love it.",+ img: "https://avatar.vercel.sh/jack",+ },+ {+ name: "Jill",+ username: "@jill",+ body: "I don't know what to say. I'm speechless. This is amazing.",+ img: "https://avatar.vercel.sh/jill",+ },+ {+ name: "John",+ username: "@john",+ body: "I'm at a loss for words. This is amazing. I love it.",+ img: "https://avatar.vercel.sh/john",+ },+ // {+ // name: "Jane",+ // username: "@jane",+ // body: "I'm at a loss for words. This is amazing. I love it.",+ // img: "https://avatar.vercel.sh/jane",+ // },+ // {+ // name: "Jenny",+ // username: "@jenny",+ // body: "I'm at a loss for words. This is amazing. I love it.",+ // img: "https://avatar.vercel.sh/jenny",+ // },+];+const firstRow = reviews.slice(0, reviews.length / 2);+const secondRow = reviews.slice(reviews.length / 2);++const ReviewCard = ({+ img,+ name,+ username,+ body,+}: {+ img: string;+ name: string;+ username: string;+ body: string;+}) => {+ return (+ <figure+ className={cn(+ "relative h-32 w-64 cursor-pointer overflow-hidden rounded-xl border p-4",+ // light styles+ "border-gray-950/[.1] bg-gray-950/[.01] hover:bg-gray-950/[.05]",+ // dark styles+ "dark:border-gray-50/[.1] dark:bg-gray-50/[.10] dark:hover:bg-gray-50/[.15]",+ )}+ >+ <div className="flex flex-row items-center gap-2">+ <img className="rounded-full" width="32" height="32" alt="" src={img} />+ <div className="flex flex-col">+ <figcaption className="text-sm font-medium dark:text-white">+ {name}+ </figcaption>+ <p className="text-xs font-medium dark:text-white/40">{username}</p>+ </div>+ </div>+ <blockquote className="mt-2 text-sm">{body}</blockquote>+ </figure>+ );+};++const MarqueeDemoVertical = () => {+ return (+ <div className="relative flex h-96 flex-row items-center justify-center gap-4 overflow-hidden rounded-lg border bg-background px-20 shadow-2xl">+ <Marquee pauseOnHover vertical className="[--duration:20s]">+ {firstRow.map((review) => (+ <ReviewCard key={review.username} {...review} />+ ))}+ </Marquee>+ <Marquee reverse pauseOnHover vertical className="[--duration:20s]">+ {secondRow.map((review) => (+ <ReviewCard key={review.username} {...review} />+ ))}+ </Marquee>+ <div className="pointer-events-none absolute inset-x-0 top-0 h-1/3 bg-gradient-to-b from-white dark:from-background"></div>+ <div className="pointer-events-none absolute inset-x-0 bottom-0 h-1/3 bg-gradient-to-t from-white dark:from-background"></div>+ </div>+ );+};++export default MarqueeDemoVertical;diff --git a/registry/components/example/marquee-logos.tsx b/registry/components/example/marquee-logos.tsxindex 92a2d9b3..f81164f2 100644--- a/registry/components/example/marquee-logos.tsx+++ b/registry/components/example/marquee-logos.tsx@@ -44,8 +44,8 @@ const MarqueeLogos = () => {<Logo key={idx} {...logo} />))}</Marquee>- <div className="pointer-events-none absolute inset-y-0 left-0 w-1/3 bg-gradient-to-r from-gray-50 dark:from-gray-950"></div>- <div className="pointer-events-none absolute inset-y-0 right-0 w-1/3 bg-gradient-to-l from-gray-50 dark:from-gray-950"></div>+ <div className="pointer-events-none absolute inset-y-0 left-0 w-1/3 bg-gradient-to-r from-white dark:from-background"></div>+ <div className="pointer-events-none absolute inset-y-0 right-0 w-1/3 bg-gradient-to-l from-white dark:from-background"></div></div>);};diff --git a/registry/components/magicui/marquee.tsx b/registry/components/magicui/marquee.tsxindex 778ffa88..eb6edd95 100644--- a/registry/components/magicui/marquee.tsx+++ b/registry/components/magicui/marquee.tsx@@ -6,30 +6,33 @@ interface MarqueeProps {reverse?: boolean;pauseOnHover?: boolean;children?: React.ReactNode;- [key: string]: any;+ vertical?: boolean;}-const Marquee = ({+export default function Marquee({className,reverse,pauseOnHover = false,children,+ vertical = false,...props-}: MarqueeProps) => {+}: MarqueeProps) {return (<div{...props}className={cn(- "flex w-full overflow-hidden [--duration:40s] [--gap:1rem]",+ "flex h-full w-full overflow-hidden [--duration:40s] [--gap:1rem]",className,)}><divclassName={cn(- "flex w-max transform-gpu animate-marquee items-stretch gap-[--gap]",+ "flex h-max w-max transform-gpu items-stretch gap-[--gap]",{"[animation-direction:reverse]": reverse,"hover:[animation-play-state:paused]": pauseOnHover,+ "animate-marquee-vertical flex-col": vertical,+ "animate-marquee flex-row": !vertical,},)}>@@ -39,6 +42,4 @@ const Marquee = ({</div></div>);-};--export default Marquee;+}diff --git a/registry/components/magicui/number-ticker.tsx b/registry/components/magicui/number-ticker.tsxindex e66f3206..465879b8 100644--- a/registry/components/magicui/number-ticker.tsx+++ b/registry/components/magicui/number-ticker.tsx@@ -6,11 +6,13 @@ import { useEffect, useRef } from "react";export default function NumberTicker({value,direction = "up",+ delay = 0,className,}: {value: number;direction?: "up" | "down";className?: string;+ delay?: number; // delay in s}) {const ref = useRef<HTMLSpanElement>(null);const motionValue = useMotionValue(direction === "down" ? value : 0);@@ -21,10 +23,10 @@ export default function NumberTicker({const isInView = useInView(ref, { once: true, margin: "-100px" });useEffect(() => {- if (isInView) {+ setTimeout(() => {motionValue.set(direction === "down" ? 0 : value);- }- }, [motionValue, isInView]);+ }, delay * 1000);+ }, [motionValue, isInView, delay]);useEffect(() =>@@ -40,7 +42,7 @@ export default function NumberTicker({return (<span- className={`inline-block w-full text-right tabular-nums ${className}`}+ className={`inline-block tabular-nums text-black dark:text-white ${className}`}ref={ref}/>);diff --git a/registry/index.tsx b/registry/index.tsxindex c4638488..2f34717e 100644--- a/registry/index.tsx+++ b/registry/index.tsx@@ -179,6 +179,14 @@ const example: Registry = {() => import("@/registry/components/example/marquee-demo"),),},+ "marquee-demo-vertical": {+ name: "marquee-demo-vertical",+ type: "components:example",+ files: ["registry/components/example/marquee-demo-vertical.tsx"],+ component: React.lazy(+ () => import("@/registry/components/example/marquee-demo-vertical"),+ ),+ },"marquee-logos": {name: "marquee-logos",type: "components:example",diff --git a/tailwind.config.ts b/tailwind.config.tsindex 8aa2f7af..515c821d 100644--- a/tailwind.config.ts+++ b/tailwind.config.ts@@ -66,6 +66,7 @@ module.exports = {meteor: "meteor 5s linear infinite",grid: "grid 15s linear infinite",marquee: "marquee var(--duration) linear infinite",+ "marquee-vertical": "marquee-vertical var(--duration) linear infinite",flip: "flip calc(var(--spark) * 2) infinite steps(2, end)",rotate: "rotate var(--spark) linear infinite both",spin: "spin calc(var(--speed) * 2) infinite linear",@@ -102,6 +103,10 @@ module.exports = {from: { transform: "translateX(0)" },to: { transform: "translateX(calc(-50% - var(--gap)/2))" },},+ "marquee-vertical": {+ from: { transform: "translateY(0)" },+ to: { transform: "translateY(calc(-50% - var(--gap)/2))" },+ },flip: {to: { rotate: "360deg" },},