-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6bcbae7
commit f1fa624
Showing
13 changed files
with
213 additions
and
78 deletions.
There are no files selected for viewing
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"use client"; | ||
import useEmblaCarousel, { EmblaOptionsType } from "embla-carousel-react"; | ||
import { useEffect, ReactNode, useState } from "react"; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
index: number; | ||
} & EmblaOptionsType; | ||
|
||
const Carousel = ({ children, index, ...options }: Props) => { | ||
// useEmblaCarousel returns a emblaRef and we must attach the ref to a container. | ||
// EmblaCarousel will use that ref as basis for swipe and other functionality. | ||
const [emblaRef, emblaApi] = useEmblaCarousel(options); | ||
const [scroll, setScroll] = useState<boolean>(true); | ||
|
||
useEffect(() => { | ||
// Only scrolls if mouse is not hovering the element | ||
if (scroll) { | ||
const interval = setInterval( | ||
() => { | ||
emblaApi?.scrollNext(); | ||
}, | ||
6000 + 1500 * index, // Sets a higher scroll interval for the 2nd banner (contains text) | ||
); | ||
return () => clearInterval(interval); | ||
} | ||
}, [emblaApi, scroll]); | ||
|
||
return ( | ||
<div | ||
className="select-none overflow-hidden shadow-sm shadow-gray-900/20" | ||
ref={emblaRef} | ||
> | ||
<div | ||
className="flex" | ||
onMouseEnter={() => setScroll(false)} | ||
onMouseLeave={() => setScroll(true)} | ||
> | ||
{children} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Carousel; |
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 @@ | ||
export { default } from "./Carousel"; |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,39 +1,43 @@ | ||
[ | ||
{ | ||
"href": "/", | ||
"image": "/summer_camp.png", | ||
"description": "CeSIUM Summer Camp 2022 Promotional Image", | ||
"span": 1 | ||
}, | ||
{ | ||
"title": "+50", | ||
"description": "Colaboradores ativos a trabalhar e contribuir para o CeSIUM diariamente.", | ||
"href": "/", | ||
"span": 1 | ||
}, | ||
{ | ||
"title": "5", | ||
"subtitle": "Departamentos", | ||
"description": "Gostavas de colaborar? Fica a saber mais dos nossos departamentos e de tudo o que fazemos.", | ||
"href": "/", | ||
"span": 2 | ||
}, | ||
{ | ||
"title": "Merch", | ||
"description": "A oportunidade perfeita para vestir o curso", | ||
"href": "/", | ||
"span": 2 | ||
}, | ||
{ | ||
"title": "+10", | ||
"description": "Parcerias com empresas e estabelecimentos comerciais.", | ||
"href": "/", | ||
"span": 1 | ||
}, | ||
{ | ||
"title": "", | ||
"href": "/", | ||
"image": "/board.png", | ||
"span": 1 | ||
} | ||
[ | ||
{ | ||
"href": "/", | ||
"image": "/summer_camp.png", | ||
"description": "CeSIUM Summer Camp 2022 Promotional Image", | ||
"span": 1 | ||
}, | ||
{ | ||
"title": "", | ||
"href": "/", | ||
"image": "/board.png", | ||
"span": 1 | ||
} | ||
], | ||
[ | ||
{ | ||
"title": "+50", | ||
"description": "Colaboradores ativos a trabalhar e contribuir para o CeSIUM diariamente.", | ||
"href": "/", | ||
"span": 1 | ||
}, | ||
{ | ||
"title": "5", | ||
"subtitle": "Departamentos", | ||
"description": "Gostavas de colaborar? Fica a saber mais dos nossos departamentos e de tudo o que fazemos.", | ||
"href": "/", | ||
"span": 1 | ||
}, | ||
{ | ||
"title": "Merch", | ||
"description": "A oportunidade perfeita para vestir o curso", | ||
"href": "/", | ||
"span": 1 | ||
}, | ||
{ | ||
"title": "+10", | ||
"description": "Parcerias com empresas e estabelecimentos comerciais.", | ||
"href": "/", | ||
"span": 1 | ||
} | ||
] | ||
] |
Oops, something went wrong.