-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into search-suggestion-redesign
- Loading branch information
Showing
12 changed files
with
474 additions
and
132 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,39 @@ | ||
// src/hooks/usePhotoCarousel.ts | ||
import { useState } from 'react'; | ||
|
||
const usePhotoCarousel = (defaultPhotos: readonly string[] = []) => { | ||
const [carouselPhotos, setCarouselPhotos] = useState<readonly string[]>(defaultPhotos); | ||
const [carouselStartIndex, setCarouselStartIndex] = useState<number>(0); | ||
const [carouselOpen, setCarouselOpen] = useState<boolean>(false); | ||
|
||
/** | ||
* showPhotoCarousel – Opens the photo carousel modal with the provided photos and start index. | ||
* | ||
* @remarks | ||
* This function sets the photos and start index for the photo carousel and then opens the carousel modal. | ||
* If no photos are provided, it defaults to [defaultPhotos]. | ||
* | ||
* @param {readonly string[]} [photos] – The array of photo URLs to display in the carousel. | ||
* @param {number} [startIndex] – The index of the photo to start the carousel from. | ||
* @return {void} – This function does not return anything. | ||
*/ | ||
const showPhotoCarousel = (photos: readonly string[] = defaultPhotos, startIndex: number = 0) => { | ||
setCarouselPhotos(photos); | ||
setCarouselStartIndex(startIndex); | ||
setCarouselOpen(true); | ||
}; | ||
|
||
const closePhotoCarousel = () => { | ||
setCarouselOpen(false); | ||
}; | ||
|
||
return { | ||
carouselPhotos, | ||
carouselStartIndex, | ||
carouselOpen, | ||
showPhotoCarousel, | ||
closePhotoCarousel, | ||
}; | ||
}; | ||
|
||
export default usePhotoCarousel; |
Oops, something went wrong.