source: frontend/src/pages/LandingPage/components/Hero.jsx@ 42da64d

Last change on this file since 42da64d was 42da64d, checked in by Andrej <asumanovski@…>, 8 weeks ago

Fixed auth issue

  • Property mode set to 100644
File size: 1.7 KB
Line 
1import React, { useEffect, useState } from "react";
2import { Link } from "react-router-dom";
3
4const Hero = () => {
5 const [isAuthed, setIsAuthed] = useState(() =>
6 Boolean(localStorage.getItem("authToken")),
7 );
8
9 useEffect(() => {
10 const onStorage = (e) => {
11 if (e.key === "authToken") {
12 setIsAuthed(Boolean(e.newValue));
13 }
14 };
15 window.addEventListener("storage", onStorage);
16 return () => window.removeEventListener("storage", onStorage);
17 }, []);
18
19 return (
20 <div
21 className="hero min-h-[calc(100vh-4rem)] bg-cover bg-center"
22 style={{
23 backgroundImage:
24 "url(https://images.unsplash.com/photo-1551288049-bebda4e38f71?auto=format&fit=crop&w=1920&q=80)",
25 }}
26 >
27 <div className="hero-overlay"></div>
28 <div className="hero-content text-neutral-content text-center px-4 py-16 sm:py-24">
29 <div className="w-full max-w-2xl">
30 <h1 className="mb-5 font-bold text-3xl sm:text-4xl md:text-5xl lg:text-6xl leading-tight">
31 Trekr — track progress, every day
32 </h1>
33 <p className="mb-6 text-sm sm:text-base md:text-lg opacity-90">
34 One self-improvement hub: workouts, weight & nutrition, finances &
35 budgeting, investing, and daily discipline tasks. Set goals, log
36 consistently, and see your progress in one place.
37 </p>
38 <Link
39 className="btn btn-primary !text-white btn-sm sm:btn-md md:btn-lg"
40 to={isAuthed ? "/dashboard" : "/register"}
41 >
42 {isAuthed ? "Go to dashboard" : "Get started"}
43 </Link>
44 </div>
45 </div>
46 </div>
47 );
48};
49
50export default Hero;
Note: See TracBrowser for help on using the repository browser.