Entrega do Desafio #2

Merged
anacarolinaduartecavalcante merged 81 commits from develop into main 2023-01-14 14:05:45 +00:00
Showing only changes of commit 2ba6dabc4b - Show all commits

View File

@ -1,18 +1,7 @@
import { useEffect, useState } from "react";
import ArrowIcon from "./assets/icons/ArrowIcon.svg";
import WhatsAppIcon from "./assets/icons/WhatsAppIcon.svg";
const SubListContent = () => {
const [backToToButton, setBackToToButton] = useState(false);
useEffect(() => {
window.addEventListener("scroll", () => {
if (window.scrollY > 129) {
setBackToToButton(true);
} else {
setBackToToButton(false);
}
});
}, []);
const scrollUp = () => {
window.scrollTo({
top: 0,
@ -31,7 +20,6 @@ const SubListContent = () => {
</a>
</li>
<li>
{backToToButton && (
<button
style={{
background: "transparent",
@ -43,7 +31,6 @@ const SubListContent = () => {
>
<img src={ArrowIcon} alt="ir para o topo da página" />
</button>
)}
</li>
</>
);