Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
feat: add scroll homepage to arrow btn
Browse files Browse the repository at this point in the history
  • Loading branch information
Wamibee committed Mar 7, 2022
1 parent e7b8aa3 commit b3e4a3a
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/pages/public/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ import {VscChevronDown} from 'react-icons/vsc';
import PlanetEarthImg from '@/assets/images/homepage/planet-earth.png';

const HomePage = () => {

function scrollTo(id){
var element = document.getElementById(id);

window.scrollTo({
top: element.offsetTop,
left: 0,
behavior: 'smooth'
});
}

return (
<div className='bg-beige'>
<div id="homepage" className="mx-auto">
Expand All @@ -25,7 +36,7 @@ const HomePage = () => {
<span className="diamond"></span>
</div>
<div className="relative my-20 w-full">
<button className="btn-round mx-auto">
<button className="btn-round mx-auto" onClick={() => scrollTo('bloc-map')}>
<VscChevronDown />
</button>
</div>
Expand All @@ -38,9 +49,9 @@ const HomePage = () => {
Carte des voyages
</h2>
</div>
<button className="btn bg-beige mx-auto my-5">
<a className="btn bg-beige mx-auto my-5 w-max" href="/map">
<span className="btn-text">Parcourir le monde</span>
</button>
</a>
</div>
<div className="earth-visual">
<div className="earth-visual-coords w-full">
Expand Down

0 comments on commit b3e4a3a

Please sign in to comment.