-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTitleHero.tsx
More file actions
51 lines (45 loc) · 1.41 KB
/
TitleHero.tsx
File metadata and controls
51 lines (45 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { useEffect, useRef } from "react";
import { motion } from "framer-motion";
import "./TitleHero.css";
interface PageHeader {
pageTitle: string;
pageDescription: string;
}
const TitleHero = ({ pageTitle, pageDescription }: PageHeader) => {
const ref = useRef<HTMLDivElement>(null);
return (
<div className="hero-container">
<div className="hero-bigtext">
{/* Background Text */}
<motion.div
className="hero-background"
initial={{ opacity: 0 }}
whileInView={{ opacity: 1 }}
transition={{ delay: 0.4, duration: 0.8, ease: "anticipate", type: "tween" }}
viewport={{ once: true }}
>
{pageTitle}
</motion.div>
{/* Foreground Content */}
<motion.div
className="hero-title"
initial={{ opacity: 0, letterSpacing: "20rem", textIndent: "20rem" }}
whileInView={{ opacity: 1, letterSpacing: "0px", textIndent: "0px" }}
transition={{ duration: 1.2, ease: "anticipate", type: "tween" }}
viewport={{ once: true }}
>
<h1>{pageTitle}</h1>
</motion.div>
</div>
<motion.div
className="hero-description"
initial={{ opacity: 0, y: -40 }}
animate={{ opacity: 1, y: 0 }}
transition={{ delay: 1 }}
>
<p>{pageDescription}</p>
</motion.div>
</div>
);
};
export default TitleHero;