-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(landing): add landing page image carousel (#1662)
* feat(landing): add image carousel with illustrations to match word carousel * fix(landing): remove automatic transition of previewCarousel * chore(landing): update gym illustration to correct version
- Loading branch information
1 parent
b8edd48
commit fee9554
Showing
8 changed files
with
967 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use client' | ||
import { useState, useEffect } from 'react' | ||
import receptionImage from 'assets/illustrations/Reception_illustration.svg' | ||
import gymImage from 'assets/illustrations/Gym_illustration.svg' | ||
import libraryImage from 'assets/illustrations/Library_illustration.svg' | ||
import schoolImage from 'assets/illustrations/School_illustration.svg' | ||
import Image from 'next/image' | ||
|
||
function ImageCarousel() { | ||
const images = [receptionImage, schoolImage, libraryImage, gymImage] | ||
const [currentImageIndex, setCurrentImageIndex] = useState(0) | ||
const [fade, setFade] = useState(true) | ||
|
||
useEffect(() => { | ||
const interval = setInterval(() => { | ||
setFade(false) | ||
|
||
setTimeout(() => { | ||
setCurrentImageIndex((currentImageIndex + 1) % images.length) | ||
setFade(true) | ||
}, 1000) | ||
}, 4000) | ||
|
||
return () => clearInterval(interval) | ||
}, [currentImageIndex, images.length]) | ||
|
||
return ( | ||
<div | ||
className={`flex flex-row self-center md:scale-90 overflow-hidden transform transition-all duration-1000 ease-in-out ${ | ||
fade ? 'opacity-100' : 'opacity-0' | ||
}`} | ||
> | ||
<Image | ||
src={images[currentImageIndex]} | ||
alt="Et bilde av en avgangstavle" | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
export { ImageCarousel } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.