Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the position #377

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 7 additions & 26 deletions src/components/BottomToTop.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React, { useState, useEffect } from "react";
import styled from "styled-components";
import { FaArrowUp } from "react-icons/fa";

const GoToTop = () => {
Expand All @@ -25,34 +24,16 @@ const GoToTop = () => {
return (
<>
{isVisible && (
<Wrapper onClick={goToTop}>
<FaArrowUp className="top-btn--icon" />
</Wrapper>
<div
onClick={goToTop}
className="flex justify-center items-center fixed bottom-20 right-5 w-12 h-12 bg-blue-500 text-white rounded-full cursor-pointer transition-transform transform hover:bg-blue-700 hover:-translate-y-1"
>
<FaArrowUp className="text-lg" />
</div>
)}
</>
);
};

const Wrapper = styled.div`
display: flex;
justify-content: center;
align-items: center;
position: fixed;
bottom: 17px;
right: 10px;
color: white;
background-color: rgb(59 130 246);
width: 48px;
height: 48px;
z-index: 9999;
border-radius: 50%;
cursor: pointer;
transition: transform 0.3s ease, background-color 0.3s ease;

&:hover {
background-color: #003a79;
transform: translateY(-5px);
}
`;

export default GoToTop;