UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: update hero dialog styles
Dillion Vermae9bac69651ac
diff --git a/registry/components/example/hero-video-dialog-demo-top-in-bottom-out.tsx b/registry/components/example/hero-video-dialog-demo-top-in-bottom-out.tsxindex da905673..740774cd 100644--- a/registry/components/example/hero-video-dialog-demo-top-in-bottom-out.tsx+++ b/registry/components/example/hero-video-dialog-demo-top-in-bottom-out.tsx@@ -1,18 +1,22 @@-import { BorderBeam } from "@/registry/components/magicui/border-beam";import HeroVideoDialog from "@/registry/components/magicui/hero-video-dialog";export default function HeroVideoDialogDemoTopInBottomOut() {return (- <section className="max-w-5xl mx-auto h-screen flex flex-col justify-center items-center px-7 lg:px-0 relative">- <div className="relative rounded-2xl p-1 overflow-hidden">- <BorderBeam />- <HeroVideoDialog- animationStyle="top-in-bottom-out"- videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb"- thumbnailSrc="https://startup-template-sage.vercel.app/hero-dark.png"- thumbnailAlt="Hero Video"- />- </div>- </section>+ <div className="relative">+ <HeroVideoDialog+ className="dark:hidden block"+ animationStyle="top-in-bottom-out"+ videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb"+ thumbnailSrc="https://startup-template-sage.vercel.app/hero-light.png"+ thumbnailAlt="Hero Video"+ />+ <HeroVideoDialog+ className="hidden dark:block"+ animationStyle="top-in-bottom-out"+ videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb"+ thumbnailSrc="https://startup-template-sage.vercel.app/hero-dark.png"+ thumbnailAlt="Hero Video"+ />+ </div>);}diff --git a/registry/components/example/hero-video-dialog-demo.tsx b/registry/components/example/hero-video-dialog-demo.tsxindex 1a0bd7e0..04ab48e0 100644--- a/registry/components/example/hero-video-dialog-demo.tsx+++ b/registry/components/example/hero-video-dialog-demo.tsx@@ -1,18 +1,22 @@-import { BorderBeam } from "@/registry/components/magicui/border-beam";import HeroVideoDialog from "@/registry/components/magicui/hero-video-dialog";export default function HeroVideoDialogDemo() {return (- <section className="max-w-5xl mx-auto h-screen flex flex-col justify-center items-center px-7 lg:px-0 relative">- <div className="relative rounded-2xl p-1 overflow-hidden">- <BorderBeam />- <HeroVideoDialog- animationStyle="from-center"- videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb"- thumbnailSrc="https://startup-template-sage.vercel.app/hero-dark.png"- thumbnailAlt="Hero Video"- />- </div>- </section>+ <div className="relative">+ <HeroVideoDialog+ className="dark:hidden block"+ animationStyle="from-center"+ videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb"+ thumbnailSrc="https://startup-template-sage.vercel.app/hero-light.png"+ thumbnailAlt="Hero Video"+ />+ <HeroVideoDialog+ className="hidden dark:block"+ animationStyle="from-center"+ videoSrc="https://www.youtube.com/embed/qh3NGpYRG3I?si=4rb-zSdDkVK9qxxb"+ thumbnailSrc="https://startup-template-sage.vercel.app/hero-dark.png"+ thumbnailAlt="Hero Video"+ />+ </div>);}diff --git a/registry/components/magicui/hero-video-dialog.tsx b/registry/components/magicui/hero-video-dialog.tsxindex 8dfba825..a0cf2c37 100644--- a/registry/components/magicui/hero-video-dialog.tsx+++ b/registry/components/magicui/hero-video-dialog.tsx@@ -1,10 +1,11 @@-/* eslint-disable @next/next/no-img-element */"use client";import { useState } from "react";import { AnimatePresence, motion } from "framer-motion";import { Play, XIcon } from "lucide-react";+import { cn } from "@/lib/utils";+type AnimationStyle =| "from-bottom"| "from-center"@@ -20,6 +21,7 @@ interface HeroVideoProps {videoSrc: string;thumbnailSrc: string;thumbnailAlt?: string;+ className?: string;}const animationVariants = {@@ -70,42 +72,34 @@ export default function HeroVideoDialog({videoSrc,thumbnailSrc,thumbnailAlt = "Video thumbnail",+ className,}: HeroVideoProps) {const [isVideoOpen, setIsVideoOpen] = useState(false);- const [isCloseHovered, setIsCloseHovered] = useState(false);- const [isPlayHovered, setIsPlayHovered] = useState(false);-- const openVideo = () => setIsVideoOpen(true);- const closeVideo = () => setIsVideoOpen(false);-const selectedAnimation = animationVariants[animationStyle];return (- <div className="relative">- <div className="relative cursor-pointer" onClick={openVideo}>+ <div className={cn("relative", className)}>+ <div+ className="relative cursor-pointer group"+ onClick={() => setIsVideoOpen(true)}+ ><imgsrc={thumbnailSrc}alt={thumbnailAlt}width={1920}height={1080}- className="w-full rounded-2xl"+ className="w-full transition-all duration-200 group-hover:brightness-[0.8] ease-out rounded-md shadow-lg border"/>- <div className="absolute inset-0 flex items-center justify-center">- <div- className="border border-neutral-800 flex items-center justify-center rounded-full backdrop-blur-md transition-transform duration-300 ease-out size-24"- onMouseEnter={() => setIsPlayHovered(true)}- onMouseLeave={() => setIsPlayHovered(false)}- >+ <div className="absolute inset-0 flex items-center justify-center group-hover:scale-100 scale-[0.9] transition-all duration-200 ease-out rounded-2xl">+ <div className="bg-primary/10 flex items-center justify-center rounded-full backdrop-blur-md size-28"><div- className={`flex items-center justify-center border border-neutral-800 rounded-full size-20 transition-all ease-out duration-300 backdrop-blur-2xl relative ${- isPlayHovered ? " scale-105" : "scale-100"- }`}+ className={`flex items-center justify-center bg-gradient-to-b from-primary/30 to-primary shadow-md rounded-full size-20 transition-all ease-out duration-200 relative group-hover:scale-[1.2] scale-100`}><Play- className="size-8 text-white"+ className="size-8 text-white fill-white group-hover:scale-105 scale-100 transition-transform duration-200 ease-out"style={{- transform: isPlayHovered ? "scale(1.1)" : "scale(1)",- transition: "transform 0.3s ease",+ filter:+ "drop-shadow(0 4px 3px rgb(0 0 0 / 0.07)) drop-shadow(0 2px 2px rgb(0 0 0 / 0.06))",}}/></div>@@ -117,6 +111,7 @@ export default function HeroVideoDialog({<motion.divinitial={{ opacity: 0 }}animate={{ opacity: 1 }}+ onClick={() => setIsVideoOpen(false)}exit={{ opacity: 0 }}className="fixed inset-0 z-50 flex items-center justify-center bg-black/50 backdrop-blur-md">@@ -125,28 +120,17 @@ export default function HeroVideoDialog({transition={{ type: "spring", damping: 30, stiffness: 300 }}className="relative w-full max-w-4xl aspect-video mx-4 md:mx-0">- <motion.button- className="absolute -top-16 right-0 text-white text-xl bg-neutral-900/50 ring-1 backdrop-blur-md rounded-full p-2"- onClick={closeVideo}- onHoverStart={() => setIsCloseHovered(true)}- onHoverEnd={() => setIsCloseHovered(false)}- whileHover={{ scale: 1.1 }}- whileTap={{ scale: 0.95 }}- >+ <motion.button className="absolute -top-16 right-0 text-white text-xl bg-neutral-900/50 ring-1 backdrop-blur-md rounded-full p-2 dark:bg-neutral-100/50 dark:text-black"><XIcon className="size-5" /></motion.button>- <motion.div- className="size-full border-2 border-white rounded-2xl overflow-hidden isolate z-[1] relative"- animate={{ scale: isCloseHovered ? 0.98 : 1 }}- transition={{ duration: 0.2 }}- >+ <div className="size-full border-2 border-white rounded-2xl overflow-hidden isolate z-[1] relative"><iframesrc={videoSrc}className="size-full rounded-2xl"allowFullScreenallow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"></iframe>- </motion.div>+ </div></motion.div></motion.div>)}