Skip to content

Commit be121f9

Browse files
committed
add animated header
1 parent 64dde76 commit be121f9

File tree

6 files changed

+90
-11
lines changed

6 files changed

+90
-11
lines changed

package-lock.json

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,15 @@
1616
"@types/node": "^16.18.104",
1717
"@types/react": "^18.3.3",
1818
"@types/react-dom": "^18.3.0",
19+
"class-variance-authority": "^0.7.0",
1920
"clsx": "^2.1.1",
2021
"framer-motion": "^11.3.19",
22+
"lucide-react": "^0.417.0",
2123
"react": "^18.3.1",
2224
"react-dom": "^18.3.1",
2325
"react-scripts": "5.0.1",
2426
"tailwind-merge": "^2.4.0",
27+
"tailwindcss-animate": "^1.0.7",
2528
"typescript": "^4.9.5",
2629
"web-vitals": "^2.1.4"
2730
},

src/components/home/AnimatedHeaderText.jsx

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
import { ChevronRight } from "lucide-react";
22

3-
import { cn } from "@/lib/utils";
4-
import AnimatedGradientText from "@/components/magicui/animated-gradient-text";
5-
6-
const AnimatedHeaderText = () => {
3+
import { cn } from "../../lib/utils";
4+
import AnimatedGradientText from "../../lib/animated-gradient-text";
5+
function AnimatedHeaderText() {
76
return (
8-
<div className="z-10 flex min-h-[16rem] items-center justify-center">
7+
<div className="z-10 flex min-h-[4rem] items-center justify-center">
98
<AnimatedGradientText>
10-
🎉 <hr className="mx-2 h-4 w-[1px] shrink-0 bg-gray-300" />{" "}
11-
<span
12-
className={cn(
13-
`inline animate-gradient bg-gradient-to-r from-[#ffaa40] via-[#9c40ff] to-[#ffaa40] bg-[length:var(--bg-size)_100%] bg-clip-text text-transparent`,
14-
)}
15-
>
9+
🎉 <hr className="mx-2 h-4 w-[1px] shrink-0 bg-gray-500" />{" "}
10+
<span>
1611
Introducing Chronos v1.0
1712
</span>
1813
<ChevronRight className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />

src/components/home/HeroSection.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { useState } from 'react'
22
import { Dialog } from '@headlessui/react'
33
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline'
44
import logo from "../../assets/logo-dark.svg";
5+
import AnimatedHeaderText from './AnimatedHeaderText';
56

67
const navigation = [
78
{ name: 'Github', href: '#' },
@@ -119,6 +120,7 @@ const HeroSection = () => {
119120
<div className="relative py-24 sm:py-32 lg:pb-40">
120121
<div className="mx-auto max-w-7xl px-6 lg:px-8">
121122
<div className="mx-auto max-w-3xl text-center">
123+
<AnimatedHeaderText />
122124
<h1 className="text-4xl font-bold tracking-tight text-gray-900 sm:text-6xl">
123125
Project management and
124126
</h1>

src/lib/animated-gradient-text.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { ReactNode } from "react";
2+
import { type ClassValue, clsx } from "clsx"
3+
import { twMerge } from "tailwind-merge"
4+
5+
function cn(...inputs: ClassValue[]) {
6+
return twMerge(clsx(inputs))
7+
}
8+
9+
10+
export default function AnimatedGradientText({
11+
children,
12+
className,
13+
}: {
14+
children: ReactNode;
15+
className?: string;
16+
}) {
17+
return (
18+
<div
19+
className={cn(
20+
"group relative mx-auto flex max-w-fit flex-row items-center justify-center rounded-2xl bg-white/40 px-4 py-1.5 text-sm font-medium backdrop-blur-sm transition-shadow duration-500 ease-out [--bg-size:300%] dark:bg-black/10",
21+
className,
22+
)}
23+
>
24+
{children}
25+
</div>
26+
);
27+
}

tailwind.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ module.exports = {
1515
},
1616
fontFamily: {
1717
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
18+
animation: {
19+
gradient: "gradient 8s linear infinite",
20+
},
21+
keyframes: {
22+
gradient: {
23+
to: {
24+
backgroundPosition: "var(--bg-size) 0",
25+
},
26+
},
27+
},
1828
},
1929
},
2030
},

0 commit comments

Comments
 (0)