Add smooth scrolling and fix formatting issues

This commit is contained in:
Pattadon 2023-11-23 02:14:15 +07:00
parent f4601b6cbe
commit 6310bd62f4
3 changed files with 127 additions and 30 deletions

View File

@ -42,7 +42,8 @@ function LoginPage() {
// On successful login, store tokens and set the authorization header // On successful login, store tokens and set the authorization header
localStorage.setItem("access_token", res.data.access); localStorage.setItem("access_token", res.data.access);
localStorage.setItem("refresh_token", res.data.refresh); localStorage.setItem("refresh_token", res.data.refresh);
axiosapi.axiosInstance.defaults.headers["Authorization"] = "Bearer " + res.data.access; axiosapi.axiosInstance.defaults.headers["Authorization"] =
"Bearer " + res.data.access;
setIsAuthenticated(true); setIsAuthenticated(true);
redirect("/"); redirect("/");
}) })
@ -85,7 +86,10 @@ function LoginPage() {
}, []); }, []);
return ( return (
<div data-theme="night" className="h-screen flex items-center justify-center"> <div
data-theme="night"
className="h-screen flex items-center justify-center"
>
{/* Particles Container */} {/* Particles Container */}
<div style={{ width: "0%", height: "100vh" }}> <div style={{ width: "0%", height: "100vh" }}>
<Particles <Particles
@ -95,6 +99,7 @@ function LoginPage() {
className="-z-10" className="-z-10"
options={{ options={{
fpsLimit: 240, fpsLimit: 240,
smooth: true,
interactivity: { interactivity: {
events: { events: {
onClick: { onClick: {
@ -199,7 +204,10 @@ function LoginPage() {
</button> </button>
<div className="divider">OR</div> <div className="divider">OR</div>
{/* Login with Google Button */} {/* Login with Google Button */}
<button className="btn btn-outline btn-secondary w-full " onClick={() => googleLoginImplicit()}> <button
className="btn btn-outline btn-secondary w-full "
onClick={() => googleLoginImplicit()}
>
<FcGoogle className="rounded-full bg-white" /> <FcGoogle className="rounded-full bg-white" />
Login with Google Login with Google
</button> </button>

View File

@ -7,7 +7,6 @@ import { loadFull } from "tsparticles";
import { FcGoogle } from "react-icons/fc"; import { FcGoogle } from "react-icons/fc";
import { useGoogleLogin } from "@react-oauth/google"; import { useGoogleLogin } from "@react-oauth/google";
function Copyright(props) { function Copyright(props) {
return ( return (
<div className="text-center text-sm text-gray-500" {...props}> <div className="text-center text-sm text-gray-500" {...props}>
@ -104,6 +103,7 @@ export default function SignUp() {
className="-z-10" className="-z-10"
options={{ options={{
fpsLimit: 240, fpsLimit: 240,
smooth: true,
interactivity: { interactivity: {
events: { events: {
onClick: { onClick: {
@ -229,13 +229,12 @@ export default function SignUp() {
className="btn btn-outline btn-secondary w-full " className="btn btn-outline btn-secondary w-full "
onClick={() => googleLoginImplicit()} onClick={() => googleLoginImplicit()}
> >
<FcGoogle className="rounded-full bg-white"/>Login with Google <FcGoogle className="rounded-full bg-white" />
Login with Google
</button> </button>
{/* Already have an account? */} {/* Already have an account? */}
<div className="text-blue-500 flex justify-center text-sm"> <div className="text-blue-500 flex justify-center text-sm">
<a href="login"> <a href="login">Already have an account?</a>
Already have an account?
</a>
</div> </div>
<Copyright /> <Copyright />
</div> </div>

View File

@ -1,28 +1,119 @@
import { useCallback } from "react";
import Particles from "react-tsparticles";
import { loadFull } from "tsparticles";
export function LandingPage() { export function LandingPage() {
const particlesInit = useCallback(async (engine) => {
console.log(engine);
await loadFull(engine);
}, []);
const particlesLoaded = useCallback(async (container) => {
console.log(container);
}, []);
return ( return (
<div> <div className="bg-black">
<div className="navbar bg-base-100"> {/* Particles Container */}
<div className="navbar-start"> <div
<a className="btn btn-ghost text-xl">TurTask</a> style={{
position: "absolute",
width: "100%",
height: "100vh",
zIndex: 0,
backgroundColor: "black",
}}
>
<Particles
id="particles"
init={particlesInit}
loaded={particlesLoaded}
className="-z-10"
options={{
fpsLimit: 240,
smooth: true,
interactivity: {
events: {
onClick: {
enable: true,
mode: "push",
},
onHover: {
enable: true,
mode: "repulse",
},
resize: true,
},
modes: {
push: {
quantity: 4,
},
repulse: {
distance: 200,
duration: 0.4,
},
},
},
particles: {
color: {
value: "#4f46e5",
},
links: {
color: "#818cf8",
distance: 150,
enable: true,
opacity: 0.5,
width: 1,
},
move: {
direction: "none",
enable: true,
outModes: {
default: "bounce",
},
random: false,
speed: 2,
straight: false,
},
number: {
density: {
enable: true,
area: 800,
},
value: 100,
},
opacity: {
value: 0.5,
},
shape: {
type: "square",
},
size: {
value: { min: 4, max: 5 },
},
},
detectRetina: true,
}}
/>
</div>
{/* Navbar */}
<div className="navbar bg-white z-10">
<div className="navbar-start z-10">
<a className="btn btn-ghost text-xl z-10 text-white">TurTask</a>
</div> </div>
<div className="navbar-end space-x-3 pr-2"> <div className="navbar-end space-x-3 pr-2 z-10">
<a className="btn" href="/login"> <a className="btn z-10" href="/login">
Login Login
</a> </a>
<a className="btn" href="/signup"> <a className="btn z-10" href="/signup">
Sign Up Sign Up
</a> </a>
</div> </div>
</div> </div>
<div className="relative" id="home"> <div className="relative" id="home">
<div aria-hidden="true" className="absolute inset-0 grid grid-cols-2 -space-x-52 opacity-40">
<div className="blur-[106px] h-56 bg-gradient-to-br from-primary to-purple-400"></div>
<div className="blur-[106px] h-32 bg-gradient-to-r from-cyan-400 to-sky-300"></div>
</div>
<div className="max-w-7xl mx-auto px-6 md:px-12 xl:px-6"> <div className="max-w-7xl mx-auto px-6 md:px-12 xl:px-6">
<div className="relative pt-36 ml-auto"> <div className="relative pt-36 ml-auto">
<div className="lg:w-2/3 text-center mx-auto"> <div className="lg:w-2/3 text-center mx-auto">
<h1 className="text-gray-900 font-bold text-5xl md:text-6xl xl:text-7xl"> <h1 className="text-gray-100 font-bold text-5xl md:text-6xl xl:text-7xl">
Manage your task with{" "} Manage your task with{" "}
<span className="text-primary"> <span className="text-primary">
TurTask TurTask
@ -33,20 +124,19 @@ export function LandingPage() {
</label> </label>
</span> </span>
</h1> </h1>
<p className="mt-8 text-gray-700"> <p className="mt-8 text-gray-400">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Odio incidunt nam itaque sed eius modi error Unleash productivity with our all-in-one task and project
totam sit illum. Voluptas doloribus asperiores quaerat aperiam. Quidem harum omnis beatae ipsum soluta! management solution. Streamline your workflow, automate tasks,
and conquer projects effortlessly.
</p> </p>
<div className="mt-16 flex flex-wrap justify-center gap-y-4 gap-x-6"> <div className="mt-16 flex flex-wrap justify-center gap-y-4 gap-x-6">
<a <a
href="/login" href="/login"
className="relative flex h-11 w-full items-center justify-center px-6 before:absolute before:inset-0 before:rounded-full before:bg-primary before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max"> className="relative flex h-11 w-full items-center justify-center px-6 before:absolute before:inset-0 before:rounded-full before:bg-primary before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max"
<span className="relative text-base font-semibold text-white">Get started</span> >
</a> <span className="relative text-base font-semibold text-white">
<a Get started
href="#" </span>
className="relative flex h-11 w-full items-center justify-center px-6 before:absolute before:inset-0 before:rounded-full before:border before:border-transparent before:bg-primary/10 before:bg-gradient-to-b before:transition before:duration-300 hover:before:scale-105 active:duration-75 active:before:scale-95 sm:w-max">
<span className="relative text-base font-semibold text-primary">Placeholder</span>
</a> </a>
</div> </div>
</div> </div>