Skip to content

Commit

Permalink
[Enhancement]: Added a typing animation to the Landing Page (#22)
Browse files Browse the repository at this point in the history
* Fix invalid import in contentlayer config

* [Enhancement]: Added a typing animation to the Landing Page

---------

Co-authored-by: Matteo Lodi <[email protected]>
Co-authored-by: Abheek Tripathy <[email protected]>
Co-authored-by: Syed Ahkam <[email protected]>
  • Loading branch information
4 people authored Mar 25, 2024
1 parent bd6155a commit 684faa4
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 12 deletions.
33 changes: 22 additions & 11 deletions components/sections/HeroSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable @next/next/no-img-element */
import Link from "next/link";
import { motion } from "framer-motion";
import { useState, useEffect } from "react";
import { TypeAnimation } from 'react-type-animation';

/* eslint-disable react/jsx-no-undef */
interface HeroSectionProps {
Expand All @@ -12,15 +12,8 @@ interface HeroSectionProps {

export default function HeroSection(props: HeroSectionProps) {
const { isMobile } = props;
const [words] = useState(["a hash.", "an ip.", "a malware.", "a domain."]);
const [currentWordIndex, setCurrentWordIndex] = useState(0);
const words = ["a hash.", 2000, "an ip.", 2000, "a malware.", 2000, "a domain.", 2000];

useEffect(() => {
const intervalId = setInterval(() => {
setCurrentWordIndex((currentIndex) => (currentIndex + 1) % words.length);
}, 3000);
return () => clearInterval(intervalId);
}, [words]);
return (
<>
{isMobile ? (
Expand All @@ -31,7 +24,16 @@ export default function HeroSection(props: HeroSectionProps) {
<div className="bg-inherit w-full flex flex-col items-center justify-center px-5">
<h1 className="text-white text-center text-3xl leading-snug lg:leading-snug xl:leading-snug font-SpaceGrotesk font-semibold ">
Get Threat Intelligence data about {" "}
<span className="text-[#00ADEF]">{words[currentWordIndex]}</span>
<span className="text-[#00ADEF]">
<TypeAnimation
sequence={words}
preRenderFirstString={false}
wrapper="span"
speed={20}
style={{ fontSize: '1em', display: 'inline-block' }}
repeat={Infinity}
/>
</span>
</h1>
<h2 className=" text-white text-center text-lg mt-8 font-SpaceGrotesk font-extralight px-4">
From multiple sources with just a{" "}
Expand Down Expand Up @@ -69,7 +71,16 @@ export default function HeroSection(props: HeroSectionProps) {
<div className="bg-inherit w-4/6 flex flex-col items-left justify-center px-16">
<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 ">
Get Threat Intelligence data about {" "}
<span className="text-[#00ADEF]">{words[currentWordIndex]}</span>
<span className="text-[#00ADEF]">
<TypeAnimation
sequence={words}
preRenderFirstString={false}
wrapper="span"
speed={20}
style={{ fontSize: '1em', display: 'inline-block' }}
repeat={Infinity}
/>
</span>
</h1>
<h2 className=" text-white text-left text-3xl lg:text-3xl xl:text-4xl mt-8 font-SpaceGrotesk font-extralight">
From multiple sources with just a{" "}
Expand Down
2 changes: 1 addition & 1 deletion contentlayer.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineDocumentType, makeSource } from '@contentlayer/source-files'
import { defineDocumentType, makeSource } from 'contentlayer/source-files'

export const Post = defineDocumentType(() => ({
name: 'Post',
Expand Down
65 changes: 65 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-scroll": "^1.8.9",
"react-type-animation": "^3.2.0",
"swiper": "^9.3.2",
"tailwindcss": "3.3.2",
"typescript": "5.0.4"
Expand Down

0 comments on commit 684faa4

Please sign in to comment.