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 1

Dillion Verma483d47a30468
diff --git a/config/docs.ts b/config/docs.ts
index f32003f3..af9a6a52 100644
--- a/config/docs.ts
+++ b/config/docs.ts
@@ -86,12 +86,12 @@ export const docsConfig: DocsConfig = {
href: `/docs/sections/header`,
items: [],
},
- // {
- // title: "Hero",
- // href: `/docs/sections/hero`,
- // items: [],
- // label: "New",
- // },
+ {
+ title: "Hero",
+ href: `/docs/sections/hero`,
+ items: [],
+ label: "New",
+ },
{
title: "Social Proof Press",
href: `/docs/sections/social-proof-press`,
diff --git a/content/docs/sections/hero.mdx b/content/docs/sections/hero.mdx
index 260e07c5..31008a3c 100644
--- a/content/docs/sections/hero.mdx
+++ b/content/docs/sections/hero.mdx
@@ -1,9 +1,9 @@
---
title: Hero Section
-date: 2024-02-27
+date: 2024-04-10
description: These components are the first thing a user sees when they land on a page. They are used to grab the user's attention and provide a brief overview of the page's content.
author: dillionverma
-published: false
+published: true
# video: https://cdn.magicui.design/animated-beam.mp4
---
diff --git a/registry/blocks/example/hero-1.tsx b/registry/blocks/example/hero-1.tsx
index 3113fc94..f84825d8 100644
--- a/registry/blocks/example/hero-1.tsx
+++ b/registry/blocks/example/hero-1.tsx
@@ -1,64 +1,117 @@
"use client";
-import { buttonVariants } from "@/components/ui/button";
import { cn } from "@/lib/utils";
-import FadeIn from "@/registry/components/magicui/fade-in";
+import RetroGrid from "@/registry/components/magicui/retro-grid";
+import { motion, useInView } from "framer-motion";
import { ChevronRight } from "lucide-react";
-import Link from "next/link";
+import { useRef } from "react";
export default function Hero() {
+ const fadeInRef = useRef(null);
+ const fadeInInView = useInView(fadeInRef, {
+ once: false,
+ margin: "-0px",
+ });
+
+ 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">
- <div className="container flex flex-col ">
+ <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">
- <FadeIn delay={0.1}>
- <h1 className="text-5xl font-bold tracking-tighter sm:text-6xl md:text-7xl lg:text-7xl">
- Professional AI Headshots
- </h1>
- </FadeIn>
- <FadeIn delay={0.1}>
- <p className="text-sm leading-normal text-muted-foreground sm:text-xl">
- Generate AI headshots in minutes.
- </p>
- </FadeIn>
- <FadeIn delay={0.2} className="flex flex-col gap-4 lg:flex-row">
- <Link
+ <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(
- buttonVariants({
- size: "lg",
- }),
- "gap-2 whitespace-pre md:flex",
- "group relative w-full gap-1 overflow-hidden text-base font-semibold tracking-tighter",
+ // 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" />
- </Link>
- </FadeIn>
- {/* <FadeIn delay={0.3}>
- <JoinUsers />
- </FadeIn> */}
+ </a>
+ </motion.div>
</div>
</div>
- <FadeIn delay={0.4} className="flex">
- <video
- autoPlay
- loop
- muted
- src="demo.mp4"
- className="mt-32 w-full rounded-lg border shadow-2xl"
- />
- </FadeIn>
+ <motion.video
+ 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",
+ }}
+ autoPlay
+ loop
+ muted
+ src="demo.mp4"
+ className="mt-32 w-full rounded-lg border shadow-2xl backdrop-blur-sm"
+ />
</div>
- {/* <CarouselVertical className="absolute right-20 top-0 hidden 2xl:block" />
- <CarouselVertical className="absolute left-20 top-0 hidden 2xl:block" /> */}
- {/* <CarouselHorizontal className="z-10 my-14" />
- <Confetti className="absolute inset-x-0 bottom-0 -z-10 mx-auto size-[800px]" /> */}
</div>
</section>
);
diff --git a/registry/components/magicui/fade-in.tsx b/registry/components/magicui/fade-in.tsx
index 0bf16d8f..a9da4fbe 100644
--- a/registry/components/magicui/fade-in.tsx
+++ b/registry/components/magicui/fade-in.tsx
@@ -44,6 +44,7 @@ export default function FadeIn({
duration: 0.6,
delay: delay || 0,
ease: [0.21, 0.47, 0.32, 0.98],
+ type: "spring",
}}
>
{children}
diff --git a/registry/components/magicui/retro-grid.tsx b/registry/components/magicui/retro-grid.tsx
index 1a926cb1..9f61d1b3 100644
--- a/registry/components/magicui/retro-grid.tsx
+++ b/registry/components/magicui/retro-grid.tsx
@@ -4,7 +4,7 @@ export default function RetroGrid({ className }: { className?: string }) {
return (
<div
className={cn(
- "absolute h-full w-full overflow-hidden [perspective:200px]",
+ "pointer-events-none absolute h-full w-full overflow-hidden opacity-50 [perspective:200px]",
className,
)}
>
@@ -14,7 +14,7 @@ export default function RetroGrid({ className }: { className?: string }) {
className={cn(
"animate-grid",
- "[background-repeat:repeat] [background-size:60px_60px] [height:100vh] [inset:0%_0px] [margin-left:-50%] [transform-origin:100%_0_0] [width:200vw]",
+ "[background-repeat:repeat] [background-size:60px_60px] [height:300vh] [inset:0%_0px] [margin-left:-100%] [transform-origin:100%_0_0] [width:200vw]",
// Light Styles
"[background-image:linear-gradient(to_right,rgba(0,0,0,0.3)_1px,transparent_0),linear-gradient(to_bottom,rgba(0,0,0,0.3)_1px,transparent_0)]",
@@ -24,9 +24,6 @@ export default function RetroGrid({ className }: { className?: string }) {
)}
/>
</div>
-
- {/* Background Gradient */}
- <div className="absolute inset-0 bg-gradient-to-b from-white to-transparent to-60% dark:from-black" />
</div>
);
}