Skip to content

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

feat: add hero section 2

Dillion Vermaefdc61d7a619
diff --git a/content/docs/sections/hero.mdx b/content/docs/sections/hero.mdx
index 31008a3c..4ddac53d 100644
--- a/content/docs/sections/hero.mdx
+++ b/content/docs/sections/hero.mdx
@@ -8,3 +8,5 @@ published: true
---
<BlockPreview name="hero-1" />
+
+<BlockPreview name="hero-2" />
diff --git a/registry/blocks/example/hero-1.tsx b/registry/blocks/example/hero-1.tsx
index f84825d8..1a3661b3 100644
--- a/registry/blocks/example/hero-1.tsx
+++ b/registry/blocks/example/hero-1.tsx
@@ -1,7 +1,7 @@
"use client";
import { cn } from "@/lib/utils";
-import RetroGrid from "@/registry/components/magicui/retro-grid";
+import { BorderBeam } from "@/registry/components/magicui/border-beam";
import { motion, useInView } from "framer-motion";
import { ChevronRight } from "lucide-react";
import { useRef } from "react";
@@ -9,8 +9,7 @@ import { useRef } from "react";
export default function Hero() {
const fadeInRef = useRef(null);
const fadeInInView = useInView(fadeInRef, {
- once: false,
- margin: "-0px",
+ once: true,
});
const fadeUpVariants = {
@@ -27,7 +26,6 @@ export default function Hero() {
return (
<section id="hero">
<div className="relative h-full overflow-hidden py-14">
- <RetroGrid className="z-0" />
<div className="container z-10 flex flex-col">
<div className="mt-20 grid grid-cols-1">
<div className="flex flex-col items-center gap-6 pb-8 text-center">
@@ -95,7 +93,7 @@ export default function Hero() {
</div>
</div>
- <motion.video
+ <motion.div
animate={fadeInInView ? "animate" : "initial"}
variants={fadeUpVariants}
initial={false}
@@ -105,12 +103,26 @@ export default function Hero() {
ease: [0.21, 0.47, 0.32, 0.98],
type: "spring",
}}
- autoPlay
- loop
- muted
- src="demo.mp4"
- className="mt-32 w-full rounded-lg border shadow-2xl backdrop-blur-sm"
- />
+ className="relative mt-24 h-full w-full rounded-xl after:absolute after:inset-0 after:z-50 after:[background:linear-gradient(to_top,#fff_30%,transparent)] dark:after:[background:linear-gradient(to_top,#000000_30%,transparent)]"
+ >
+ {/* <video
+ autoPlay
+ loop
+ muted
+ src="demo.mp4"
+ className="h-auto w-full"
+ /> */}
+ <img
+ src="/dashboard-light.png"
+ className="block h-full w-full rounded-xl border dark:hidden"
+ />
+ <img
+ src="/dashboard-dark.png"
+ className="hidden h-full w-full rounded-xl border dark:block"
+ />
+ <BorderBeam />
+ <BorderBeam delay={20} />
+ </motion.div>
</div>
</div>
</section>
diff --git a/registry/blocks/example/hero-2.tsx b/registry/blocks/example/hero-2.tsx
new file mode 100644
index 00000000..9efab3e1
--- /dev/null
+++ b/registry/blocks/example/hero-2.tsx
@@ -0,0 +1,131 @@
+"use client";
+
+import { cn } from "@/lib/utils";
+import { BorderBeam } from "@/registry/components/magicui/border-beam";
+import RetroGrid from "@/registry/components/magicui/retro-grid";
+import { motion, useInView } from "framer-motion";
+import { ChevronRight } from "lucide-react";
+import { useRef } from "react";
+
+export default function Hero() {
+ const fadeInRef = useRef(null);
+ const fadeInInView = useInView(fadeInRef, {
+ once: true,
+ });
+
+ const fadeUpVariants = {
+ initial: {
+ opacity: 0,
+ y: 24,
+ },
+ animate: {
+ opacity: 1,
+ y: 0,
+ },
+ };
+
+ return (
+ <section id="hero">
+ <div className="relative h-full overflow-hidden py-14">
+ <RetroGrid className="z-0" />
+ <div className="container z-10 flex flex-col">
+ <div className="mt-20 grid grid-cols-1">
+ <div className="flex flex-col items-center gap-6 pb-8 text-center">
+ <motion.h1
+ ref={fadeInRef}
+ className="text-balance bg-gradient-to-br from-black from-30% to-black/60 bg-clip-text py-6 text-5xl font-medium leading-none tracking-tighter text-transparent dark:from-white dark:to-white/40 sm:text-6xl md:text-7xl lg:text-8xl"
+ animate={fadeInInView ? "animate" : "initial"}
+ variants={fadeUpVariants}
+ initial={false}
+ transition={{
+ duration: 0.6,
+ delay: 0.1,
+ ease: [0.21, 0.47, 0.32, 0.98],
+ type: "spring",
+ }}
+ >
+ Create Magical <br /> Landing Pages <br />
+ </motion.h1>
+
+ <motion.p
+ className="text-balance text-lg tracking-tight text-gray-400 md:text-xl"
+ animate={fadeInInView ? "animate" : "initial"}
+ variants={fadeUpVariants}
+ initial={false}
+ transition={{
+ duration: 0.6,
+ delay: 0.2,
+ ease: [0.21, 0.47, 0.32, 0.98],
+ type: "spring",
+ }}
+ >
+ Magic UI is a curated collection of React + Tailwind CSS +
+ Framer Motion components
+ </motion.p>
+
+ <motion.div
+ animate={fadeInInView ? "animate" : "initial"}
+ variants={fadeUpVariants}
+ className="flex flex-col gap-4 lg:flex-row"
+ initial={false}
+ transition={{
+ duration: 0.6,
+ delay: 0.3,
+ ease: [0.21, 0.47, 0.32, 0.98],
+ type: "spring",
+ }}
+ >
+ <a
+ href="/login"
+ className={cn(
+ // colors
+ "bg-black text-white shadow hover:bg-black/90 dark:bg-white dark:text-black dark:hover:bg-white/90",
+
+ // layout
+ "group relative inline-flex h-9 w-full items-center justify-center gap-2 overflow-hidden whitespace-pre rounded-md px-4 py-2 text-base font-semibold tracking-tighter focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 md:flex",
+
+ // animation
+ "transform-gpu ring-offset-current transition-all duration-300 ease-out hover:ring-2 hover:ring-primary hover:ring-offset-2",
+ )}
+ >
+ Get Started
+ <ChevronRight className="size-4 translate-x-0 transition-all duration-300 ease-out group-hover:translate-x-1" />
+ </a>
+ </motion.div>
+ </div>
+ </div>
+
+ <motion.div
+ animate={fadeInInView ? "animate" : "initial"}
+ variants={fadeUpVariants}
+ initial={false}
+ transition={{
+ duration: 0.6,
+ delay: 0.4,
+ ease: [0.21, 0.47, 0.32, 0.98],
+ type: "spring",
+ }}
+ className="relative mt-24 h-full w-full rounded-xl border shadow-2xl"
+ >
+ {/* <video
+ autoPlay
+ loop
+ muted
+ src="demo.mp4"
+ className="h-auto w-full"
+ /> */}
+ <img
+ src="/dashboard-light.png"
+ className="block h-full w-full rounded-xl dark:hidden"
+ />
+ <img
+ src="/dashboard-dark.png"
+ className="hidden h-full w-full rounded-xl dark:block"
+ />
+ <BorderBeam />
+ </motion.div>
+ </div>
+ </div>
+ </section>
+ );
+}
diff --git a/registry/components/magicui/border-beam.tsx b/registry/components/magicui/border-beam.tsx
index 2cfc9c49..516af400 100644
--- a/registry/components/magicui/border-beam.tsx
+++ b/registry/components/magicui/border-beam.tsx
@@ -13,7 +13,7 @@ interface BorderBeamProps {
export const BorderBeam = ({
className,
- size = 100,
+ size = 200,
duration = 15,
anchor = 90,
borderWidth = 1.5,
diff --git a/registry/index.tsx b/registry/index.tsx
index c057566a..08d7a1d9 100644
--- a/registry/index.tsx
+++ b/registry/index.tsx
@@ -561,6 +561,12 @@ const blocks: Registry = {
files: ["registry/blocks/example/hero-1.tsx"],
component: React.lazy(() => import("@/registry/blocks/example/hero-1")),
},
+ "hero-2": {
+ name: "hero-2",
+ type: "blocks:example",
+ files: ["registry/blocks/example/hero-2.tsx"],
+ component: React.lazy(() => import("@/registry/blocks/example/hero-2")),
+ },
"social-proof-press-1": {
name: "social-proof-press-1",
type: "blocks:example",