Skip to content

Commit

Permalink
Add scroll animation on About cards (small screen)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshay-rajan committed Aug 11, 2024
1 parent ae029a9 commit a683a83
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/AboutCard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,24 @@ export default function AboutCard(props) {
return color;
};

// Scroll to About section when clicked on a card (only on small screens)
const handleClick = () => {
const div = document.getElementById('about');
if (div) {
div.scrollIntoView({ behavior: 'smooth' });
}
};

return (
<>
<div
style={props.isExpanded ? {display: 'none'} : (window.innerWidth < 798 ? smallContainer : container)}
onMouseEnter={() => {
props.setExpanded(true);
props.setHovering(props.title);
}
}>
}}
onClick={handleClick}
>
<div style={title}>{props.title}</div>
<div style={desc}>
{props.description}
Expand Down

0 comments on commit a683a83

Please sign in to comment.