2023-05-21 02:20:55 +03:00
|
|
|
"use client";
|
2023-05-26 14:56:29 +03:00
|
|
|
import { motion, useScroll, useSpring, useTransform } from "framer-motion";
|
2023-05-18 14:37:03 +03:00
|
|
|
import Link from "next/link";
|
2023-06-15 12:52:46 +03:00
|
|
|
import { useRef } from "react";
|
2023-08-07 15:13:41 +03:00
|
|
|
import { useTranslation } from "react-i18next";
|
2023-05-18 14:37:03 +03:00
|
|
|
import { MdNorthEast } from "react-icons/md";
|
|
|
|
|
2023-06-15 12:52:46 +03:00
|
|
|
import Button from "@/lib/components/ui/Button";
|
|
|
|
|
|
|
|
const Hero = (): JSX.Element => {
|
2023-08-07 15:13:41 +03:00
|
|
|
const { t } = useTranslation();
|
|
|
|
|
2023-05-21 02:20:55 +03:00
|
|
|
const targetRef = useRef<HTMLDivElement | null>(null);
|
|
|
|
const { scrollYProgress } = useScroll({
|
|
|
|
target: targetRef,
|
|
|
|
offset: ["start start", "end start"],
|
|
|
|
});
|
|
|
|
|
|
|
|
const scaleSync = useTransform(scrollYProgress, [0, 0.5], [1, 0.9]);
|
|
|
|
const scale = useSpring(scaleSync, { mass: 0.1, stiffness: 100 });
|
|
|
|
|
|
|
|
const position = useTransform(scrollYProgress, (pos) => {
|
|
|
|
if (pos === 1) {
|
|
|
|
return "relative";
|
|
|
|
}
|
2023-06-15 12:52:46 +03:00
|
|
|
|
2023-05-21 02:20:55 +03:00
|
|
|
return "sticky";
|
|
|
|
});
|
|
|
|
|
2023-05-23 13:45:10 +03:00
|
|
|
const videoScaleSync = useTransform(scrollYProgress, [0, 0.5], [0.9, 1]);
|
2023-05-21 02:20:55 +03:00
|
|
|
const videoScale = useSpring(videoScaleSync, { mass: 0.1, stiffness: 100 });
|
|
|
|
|
|
|
|
const opacitySync = useTransform(scrollYProgress, [0, 0.5], [1, 0]);
|
|
|
|
const opacity = useSpring(opacitySync, { mass: 0.1, stiffness: 200 });
|
|
|
|
|
2023-05-18 14:37:03 +03:00
|
|
|
return (
|
2023-05-21 02:20:55 +03:00
|
|
|
<section
|
|
|
|
ref={targetRef}
|
|
|
|
className="relative w-full flex flex-col gap-24 items-center text-center min-h-[768px] py-12"
|
|
|
|
>
|
|
|
|
<motion.div
|
|
|
|
style={{ scale, opacity, position }}
|
|
|
|
className="top-24 -z-0 flex flex-col gap-2 items-center justify-center pt-24"
|
|
|
|
>
|
2023-05-23 13:45:10 +03:00
|
|
|
<h1 className="text-5xl sm:text-7xl font-bold max-w-lg sm:max-w-xl">
|
2023-08-07 15:13:41 +03:00
|
|
|
{t("title.short")} <span className="text-primary">Quivr</span>
|
2023-05-18 14:37:03 +03:00
|
|
|
</h1>
|
2023-05-23 13:45:10 +03:00
|
|
|
<p className="text-base max-w-sm text-gray-500 mb-5 sm:mb-10">
|
2023-08-07 15:13:41 +03:00
|
|
|
{t("description")}
|
2023-05-18 14:37:03 +03:00
|
|
|
</p>
|
2023-07-10 18:30:15 +03:00
|
|
|
<Link href={"/login"}>
|
2023-08-07 15:13:41 +03:00
|
|
|
<Button>{t("getStarted")}</Button>
|
2023-05-18 14:37:03 +03:00
|
|
|
</Link>
|
|
|
|
<Link target="_blank" href={"https://github.com/StanGirard/quivr/"}>
|
|
|
|
<Button variant={"tertiary"}>
|
|
|
|
Github <MdNorthEast />
|
|
|
|
</Button>
|
|
|
|
</Link>
|
2023-05-21 02:20:55 +03:00
|
|
|
</motion.div>
|
|
|
|
<motion.video
|
|
|
|
style={{ scale: videoScale }}
|
|
|
|
className="rounded-md max-w-screen-lg shadow-lg dark:shadow-white/25 border dark:border-white/25 w-full bg-white dark:bg-black"
|
2023-07-02 23:30:39 +03:00
|
|
|
src="https://user-images.githubusercontent.com/19614572/239713902-a6463b73-76c7-4bc0-978d-70562dca71f5.mp4"
|
2023-05-18 14:37:03 +03:00
|
|
|
autoPlay
|
|
|
|
muted
|
|
|
|
loop
|
|
|
|
/>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Hero;
|