2022-12-13 01:02:18 -07:00
|
|
|
import { useState, useEffect } from "react";
|
|
|
|
|
2022-12-08 12:10:01 -07:00
|
|
|
export default function ToApp() {
|
2022-12-13 01:02:18 -07:00
|
|
|
const [showButton, setShowButton] = useState(true);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const handleScroll = () => {
|
|
|
|
if (window.scrollY < 2) {
|
|
|
|
setShowButton(true);
|
|
|
|
} else {
|
|
|
|
setShowButton(false);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
window.addEventListener("scroll", handleScroll);
|
|
|
|
return () => window.removeEventListener("scroll", handleScroll);
|
|
|
|
}, []);
|
|
|
|
|
2022-12-08 12:10:01 -07:00
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<button
|
|
|
|
type="button"
|
2022-12-14 03:05:28 -07:00
|
|
|
className="fixed z-10 top-4 right-6 md:top-12 md:right-12 text-white bg-gradient-to-br from-purple-600 to-sky-500 hover:bg-gradient-to-bl w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-2xl hover:text-white hover:bg-sky-600 hover:drop-shadow-2xl"
|
2022-12-08 12:10:01 -07:00
|
|
|
onClick={() => window.location.href = "/"}
|
|
|
|
>
|
|
|
|
🎸
|
|
|
|
</button>
|
2022-12-13 01:02:18 -07:00
|
|
|
|
|
|
|
{showButton && (
|
2022-12-14 03:05:28 -07:00
|
|
|
<div className="fixed z-20 top-8 right-6 md:top-16 md:right-12 text-white bg-gradient-to-br w-14 h-14 rounded-full drop-shadow-lg flex justify-center items-center text-2xl">
|
2022-12-13 01:02:18 -07:00
|
|
|
<span className="absolute bottom-0 -right-2 bg-white text-black rounded-full p-1 pr-2 pl-2 text-xs">Try it!</span>
|
|
|
|
<button
|
|
|
|
type="button"
|
|
|
|
className="z-30 w-16 h-16 rounded-full"
|
|
|
|
onClick={() => window.location.href = "/"}
|
|
|
|
>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
2022-12-08 12:10:01 -07:00
|
|
|
</>
|
|
|
|
);
|
2022-12-12 17:35:33 -07:00
|
|
|
};
|