| import React, { useEffect } from "react"; |
| import styled from "styled-components"; |
| import { gsap } from "gsap"; |
| import ScrollTrigger from "gsap/ScrollTrigger"; |
| import { useNavigate } from "react-router-dom"; |
|
|
| |
| gsap.registerPlugin(ScrollTrigger); |
|
|
| |
| const Section = styled.section` |
| padding: 5rem 0; |
| background-color: white; |
| display: flex; |
| align-items: center; |
| justify-content: center; |
| flex-direction: column; |
| height: 50vh; /* Full viewport height */ |
| |
| @media(max-width:768px){ |
| height: 60vh; |
| } |
| `; |
|
|
| const Container = styled.div` |
| text-align: center; |
| `; |
|
|
| const Title = styled.h1` |
| font-size: 2.5rem; |
| color: #3f3f3f; |
| opacity: 0; /* Initially hidden */ |
| transform: translateY(50px); /* Initially moved down */ |
| `; |
|
|
| const Button = styled.button` |
| margin-top: 2rem; |
| padding: 1rem 2rem; |
| font-weight: bold; |
| background: #3267B9; |
| color: white; |
| border-radius: 30px; |
| border: none; |
| font-size: 1.125rem; |
| cursor: pointer; |
| transform: scale(0.9); /* Initially scaled down */ |
| opacity: 0; /* Initially hidden */ |
| transition: opacity 1s ease-out, transform 1s ease-out 0.5s; |
| box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); |
| |
| &:hover { |
| background: #3f7ad3; |
| } |
| `; |
|
|
| const BookDemo = () => { |
| const navigate = useNavigate(); |
|
|
| useEffect(() => { |
| |
| gsap.fromTo( |
| "#demo-title", |
| { |
| opacity: 0, |
| y: 50, |
| }, |
| { |
| opacity: 1, |
| y: 0, |
| duration: 1, |
| ease: "power4.out", |
| scrollTrigger: { |
| trigger: "#demo-title", |
| start: "top 80%", |
| end: "top 30%", |
| scrub: true, |
| }, |
| } |
| ); |
|
|
| |
| gsap.fromTo( |
| "#demo-button", |
| { |
| opacity: 0, |
| scale: 0.9, |
| }, |
| { |
| opacity: 1, |
| scale: 1, |
| duration: 1, |
| delay: 0.5, |
| ease: "power4.out", |
| scrollTrigger: { |
| trigger: "#demo-button", |
| start: "top 80%", |
| end: "top 30%", |
| scrub: true, |
| }, |
| } |
| ); |
| }, []); |
|
|
| |
| const handleBookDemo = () => { |
| |
| navigate("/contact", { |
| state: { |
| formType: "demo", |
| product: "VarDiG SaaS", |
| }, |
| }); |
| }; |
|
|
| return ( |
| <Section> |
| <Container> |
| <Title id="demo-title"> |
| Seems interesting? Book a Demo |
| </Title> |
| <Button id="demo-button" onClick={handleBookDemo} data-testid='demo-button'> |
| Book Demo |
| </Button> |
| </Container> |
| </Section> |
| ); |
| }; |
|
|
| export default BookDemo; |