Skip to content

Commit

Permalink
feat:Add Scroll to Top Button
Browse files Browse the repository at this point in the history
  • Loading branch information
gyanendra-baghel committed Jun 5, 2024
1 parent 80a33af commit f707a89
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
4 changes: 3 additions & 1 deletion client/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import About from "./components/About/About";

import { useEffect, useState } from "react";
import Loader from "./components/Loader";
import { BiArrowToTop } from "react-icons/bi";

function Layout() {
const { user } = useSelector((state) => state.user);
Expand Down Expand Up @@ -74,7 +75,7 @@ function App() {
<Route
path={
user?.user?.accountType === "seeker"
? "/user-profile"
? "/user-profile"
: "/user-profile/:id"
}
element={<UserProfile />}
Expand All @@ -91,6 +92,7 @@ function App() {
element={<Navigate to="/find-jobs" replace={true} />}
/>
</Routes>
<BiArrowToTop className="fixed bottom-4 right-4 border rounded-full p-1" size={50} onClick={()=>{window.scrollTo({ top: 0, left: 0, behavior: "smooth"});}}/>
{user && <Footer />}
</main>
);
Expand Down
1 change: 0 additions & 1 deletion client/src/components/About/About.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const About = () => {
<SectionSecond />
<SectionThird />
<SectionFourth />

</div>
);
};
Expand Down
3 changes: 0 additions & 3 deletions client/src/pages/Companies.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React, { useEffect, useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { CompanyCard, CustomButton, Header, ListBox } from "../components";
import { companies } from "../utils/data";
import { BiArrowToTop } from "react-icons/bi";

const Companies = () => {
const [page, setPage] = useState(1);
Expand Down Expand Up @@ -84,8 +83,6 @@ const Companies = () => {
</div>
)}
</div>
{/* Top Scroll Btn */}
<BiArrowToTop className="fixed bottom-4 right-4 border rounded-full p-1" size={50} onClick={() => { window.scrollTo({ top: 0, left: 0, behavior: "smooth" }); }} />
</div>
);
};
Expand Down
4 changes: 1 addition & 3 deletions client/src/pages/FindJobs.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useState } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { BiArrowToTop, BiBriefcaseAlt2 } from "react-icons/bi";
import { BiBriefcaseAlt2 } from "react-icons/bi";
import { BsStars } from "react-icons/bs";
import { MdOutlineKeyboardArrowDown } from "react-icons/md";

Expand Down Expand Up @@ -151,8 +151,6 @@ const FindJobs = () => {
)}
</div>
</div>
{/* Top Scroll Btn */}
<BiArrowToTop className="fixed bottom-4 right-4 border rounded-full p-1" size={50} onClick={() => { window.scrollTo({ top: 0, left: 0, behavior: "smooth" }); }} />
</div>
);
};
Expand Down

0 comments on commit f707a89

Please sign in to comment.