3
3
/* eslint-disable @next/next/no-img-element */
4
4
import Link from "next/link" ;
5
5
import { motion } from "framer-motion" ;
6
- import { useState , useEffect } from " react" ;
6
+ import { TypeAnimation } from ' react-type-animation' ;
7
7
8
8
/* eslint-disable react/jsx-no-undef */
9
9
interface HeroSectionProps {
@@ -12,15 +12,8 @@ interface HeroSectionProps {
12
12
13
13
export default function HeroSection ( props : HeroSectionProps ) {
14
14
const { isMobile } = props ;
15
- const [ words ] = useState ( [ "a hash." , "an ip." , "a malware." , "a domain." ] ) ;
16
- const [ currentWordIndex , setCurrentWordIndex ] = useState ( 0 ) ;
15
+ const words = [ "a hash." , 2000 , "an ip." , 2000 , "a malware." , 2000 , "a domain." , 2000 ] ;
17
16
18
- useEffect ( ( ) => {
19
- const intervalId = setInterval ( ( ) => {
20
- setCurrentWordIndex ( ( currentIndex ) => ( currentIndex + 1 ) % words . length ) ;
21
- } , 3000 ) ;
22
- return ( ) => clearInterval ( intervalId ) ;
23
- } , [ words ] ) ;
24
17
return (
25
18
< >
26
19
{ isMobile ? (
@@ -31,7 +24,16 @@ export default function HeroSection(props: HeroSectionProps) {
31
24
< div className = "bg-inherit w-full flex flex-col items-center justify-center px-5" >
32
25
< h1 className = "text-white text-center text-3xl leading-snug lg:leading-snug xl:leading-snug font-SpaceGrotesk font-semibold " >
33
26
Get Threat Intelligence data about { " " }
34
- < span className = "text-[#00ADEF]" > { words [ currentWordIndex ] } </ span >
27
+ < span className = "text-[#00ADEF]" >
28
+ < TypeAnimation
29
+ sequence = { words }
30
+ preRenderFirstString = { false }
31
+ wrapper = "span"
32
+ speed = { 20 }
33
+ style = { { fontSize : '1em' , display : 'inline-block' } }
34
+ repeat = { Infinity }
35
+ />
36
+ </ span >
35
37
</ h1 >
36
38
< h2 className = " text-white text-center text-lg mt-8 font-SpaceGrotesk font-extralight px-4" >
37
39
From multiple sources with just a{ " " }
@@ -69,7 +71,16 @@ export default function HeroSection(props: HeroSectionProps) {
69
71
< div className = "bg-inherit w-4/6 flex flex-col items-left justify-center px-16" >
70
72
< h1 className = "text-white text-left text-5xl lg:text-6xl xl:text-7xl leading-snug lg:leading-snug xl:leading-snug font-SpaceGrotesk font-semibold " >
71
73
Get Threat Intelligence data about { " " }
72
- < span className = "text-[#00ADEF]" > { words [ currentWordIndex ] } </ span >
74
+ < span className = "text-[#00ADEF]" >
75
+ < TypeAnimation
76
+ sequence = { words }
77
+ preRenderFirstString = { false }
78
+ wrapper = "span"
79
+ speed = { 20 }
80
+ style = { { fontSize : '1em' , display : 'inline-block' } }
81
+ repeat = { Infinity }
82
+ />
83
+ </ span >
73
84
</ h1 >
74
85
< h2 className = " text-white text-left text-3xl lg:text-3xl xl:text-4xl mt-8 font-SpaceGrotesk font-extralight" >
75
86
From multiple sources with just a{ " " }
0 commit comments