Skip to content
Closed
Show file tree
Hide file tree
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
45 changes: 45 additions & 0 deletions frontend/src/ScrollToTopButton.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { useEffect, useState } from 'react';
import { IconButton } from '@chakra-ui/react';
import { ArrowUpIcon } from '@chakra-ui/icons';

const ScrollToTopButton = () => {
const [isVisible, setIsVisible] = useState(false);

const toggleVisibility = () => {
if (window.scrollY > 200) {
setIsVisible(true);
} else {
setIsVisible(false);
}
};
const scrollToTop = () => {
window.scrollTo({
top: 0,
behavior: 'smooth',
});
};

useEffect(() => {
window.addEventListener('scroll', toggleVisibility);
return () => window.removeEventListener('scroll', toggleVisibility);
}, []);

return (
isVisible && (
<IconButton
position="fixed"
bottom="20px"
right="20px"
colorScheme="teal"
icon={<ArrowUpIcon />}
onClick={scrollToTop}
aria-label="Scroll to top"
size="lg"
boxShadow="lg"
zIndex="1000"
/>
)
);
};

export default ScrollToTopButton;
3 changes: 3 additions & 0 deletions frontend/src/styles/Card.module.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.card {
min-height: 320px;
border-radius: 15px;
box-shadow: 0px 0px 40px 8px rgba(134, 119, 206, 0.05);
}
}
.announcement {
background: linear-gradient(
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/styles/Hero.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
width: 90%;
margin: auto;
border-radius: 15px;
}