Skip to content

Commit

Permalink
ScrollToTop widget
Browse files Browse the repository at this point in the history
  • Loading branch information
sau-mili committed May 30, 2024
1 parent 9933433 commit a72f882
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/components/Dashboard/Dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
text-align: center;
background-color: #CAE7FE;
}
.scroll{
z-index: 10000;
padding: 1rem 1rem!important;
align-items: center !important;
justify-items: center !important;
right:20px !important;
margin-top: -2rem;
position: absolute;
box-shadow: 0 0 4px grey !important;
cursor: pointer;
}

.navbar {
display: flex;
Expand Down
15 changes: 14 additions & 1 deletion src/components/Dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ const Dashboard = () => {
setActiveIndex(null);
};




const [fix, setFix]= useState(false)
//function for appearance of background for nav menu
function setFixed(){
Expand All @@ -84,7 +87,17 @@ window.addEventListener("scroll", setFixed)
//scrolltotop is for scroll to top widget
//Then the navbar code begins
<main>
<ScrollToTop color="white" style={{ backgroundColor: "#5CB6F9" }} />
<div className="scroll">
<ScrollToTop
smooth
viewBox="0 0 24 24"
svgPath="M16 13a1 1 0 0 1-.707-.293L12 9.414l-3.293 3.293a1 1 0 1 1-1.414-1.414l4-4a1 1 0 0 1 1.414 0l4 4A1 1 0 0 1 16 13z M16 17a1 1 0 0 1-.707-.293L12 13.414l-3.293 3.293a1 1 0 1 1-1.414-1.414l4-4a1 1 0 0 1 1.414 0l4 4A1 1 0 0 1 16 17z"

color="white"
style={{ backgroundColor: "#5CB6F9" }}
/>
{/* <ScrollToTop color="white" style={{ backgroundColor: "#5CB6F9" }} /> */}
</div>
<nav className={`navbar ${fix ? 'fixed' : ''}`}>
<div className="logo">
<img src={Logo} alt="Logo" />
Expand Down
8 changes: 8 additions & 0 deletions src/components/Dashboard/chevron-up-double-svgrepo-com.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a72f882

Please sign in to comment.