@ticketboothapp/booking 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/BookingWidget.tsx +282 -26
- package/src/components/ManageBookingView.tsx +75 -23
- package/src/components/booking/BookingProductGrid.tsx +1 -1
- package/src/components/booking/Calendar.module.css +3 -3
- package/src/components/booking/CheckoutForm.tsx +1 -1
- package/src/components/booking/InfoTooltip.tsx +2 -13
- package/src/components/booking/PickupLocationSelector.tsx +2 -2
- package/src/components/booking/PriceBreakdown.tsx +11 -34
- package/src/index.ts +3 -1
- package/src/app/photo-sessions/photo-packages.ts +0 -75
- package/src/assets/icons/minus.svg +0 -7
- package/src/assets/icons/partner-logos/getyourguide.svg +0 -8
- package/src/assets/icons/plus.svg +0 -3
- package/src/colours.css +0 -23
- package/src/components/BookingDetails.module.css +0 -1591
- package/src/components/BookingDetails.tsx +0 -2264
- package/src/components/JobApplicationDialog.module.css +0 -440
- package/src/components/JobApplicationDialog.tsx +0 -620
- package/src/components/PhoneInputWithCountry.module.css +0 -131
- package/src/components/PhoneInputWithCountry.tsx +0 -44
- package/src/components/PickupLocationDialog.module.css +0 -360
- package/src/components/PickupLocationDialog.tsx +0 -357
- package/src/components/PickupLocationMap.tsx +0 -110
- package/src/components/PostBookingDependentAddOnUpsell.module.css +0 -174
- package/src/components/PostBookingDependentAddOnUpsell.tsx +0 -407
- package/src/components/accordion.css +0 -27
- package/src/components/accordion.tsx +0 -29
- package/src/components/analytics/AnalyticsConsentRestore.tsx +0 -19
- package/src/components/analytics/AnalyticsScripts.tsx +0 -106
- package/src/components/analytics/CookieConsentBanner.css +0 -86
- package/src/components/analytics/CookieConsentBanner.tsx +0 -102
- package/src/components/bottom-sheet.module.css +0 -78
- package/src/components/bottom-sheet.tsx +0 -60
- package/src/components/breadcrumb.module.css +0 -40
- package/src/components/breadcrumb.tsx +0 -36
- package/src/components/button.css +0 -245
- package/src/components/button.tsx +0 -152
- package/src/components/client-bottom-sheet.tsx +0 -14
- package/src/components/colorable-svg.tsx +0 -29
- package/src/components/conditional-footer.tsx +0 -27
- package/src/components/contact-us.module.css +0 -147
- package/src/components/contact-us.tsx +0 -49
- package/src/components/email-signup.css +0 -151
- package/src/components/email-signup.tsx +0 -63
- package/src/components/faq-wrapper.module.css +0 -47
- package/src/components/faq-wrapper.tsx +0 -15
- package/src/components/footer.css +0 -187
- package/src/components/footer.tsx +0 -143
- package/src/components/global-simple-modal.tsx +0 -33
- package/src/components/google-review-summary.module.css +0 -77
- package/src/components/google-review-summary.tsx +0 -50
- package/src/components/hero-image.css +0 -13
- package/src/components/hero-image.tsx +0 -44
- package/src/components/image.css +0 -29
- package/src/components/image.tsx +0 -113
- package/src/components/language-aware-link.tsx +0 -72
- package/src/components/language-switcher.module.css +0 -124
- package/src/components/language-switcher.tsx +0 -75
- package/src/components/map-section.css +0 -59
- package/src/components/map-section.tsx +0 -63
- package/src/components/navbar.module.css +0 -152
- package/src/components/navbar.tsx +0 -125
- package/src/components/parallax-provider.tsx +0 -11
- package/src/components/product-tag.module.css +0 -30
- package/src/components/product-tag.tsx +0 -34
- package/src/components/product-theme-pages/best-option.module.css +0 -70
- package/src/components/product-theme-pages/best-option.tsx +0 -35
- package/src/components/product-theme-pages/extended-tour-options.module.css +0 -22
- package/src/components/product-theme-pages/extended-tour-options.tsx +0 -11
- package/src/components/product-theme-pages/image-modal.tsx +0 -248
- package/src/components/product-theme-pages/photo-gallery.module.css +0 -200
- package/src/components/product-theme-pages/photo-gallery.tsx +0 -90
- package/src/components/product-theme-pages/product-theme-page-layout.module.css +0 -13
- package/src/components/product-theme-pages/product-theme-page-layout.tsx +0 -67
- package/src/components/product-theme-pages/top-of-fold.module.css +0 -179
- package/src/components/product-theme-pages/top-of-fold.tsx +0 -80
- package/src/components/product-tile/image-only-product-tile-desktop.module.css +0 -106
- package/src/components/product-tile/image-only-product-tile-desktop.tsx +0 -56
- package/src/components/product-tile/image-only-product-tile-mobile.module.css +0 -122
- package/src/components/product-tile/image-only-product-tile-mobile.tsx +0 -89
- package/src/components/product-tile/image-only-product-tile.tsx +0 -44
- package/src/components/product-tile/product-tile-card.module.css +0 -84
- package/src/components/product-tile/product-tile-card.tsx +0 -61
- package/src/components/review-highlights-section.css +0 -85
- package/src/components/review-highlights-section.tsx +0 -127
- package/src/components/season-closure-overlay.module.css +0 -99
- package/src/components/season-closure-overlay.tsx +0 -98
- package/src/components/simple-modal.tsx +0 -69
- package/src/components/simple-top-of-fold.module.css +0 -76
- package/src/components/simple-top-of-fold.tsx +0 -34
- package/src/components/spacer.css +0 -41
- package/src/components/spacer.tsx +0 -23
- package/src/components/star-rating.module.css +0 -74
- package/src/components/star-rating.tsx +0 -48
- package/src/components/terms/TermsContent.tsx +0 -178
- package/src/components/title-subtitle.module.css +0 -10
- package/src/components/title-subtitle.tsx +0 -30
- package/src/components/translatable-reviews.tsx +0 -75
- package/src/components/value-pill.module.css +0 -59
- package/src/components/value-pill.tsx +0 -46
- package/src/components/value-props.css +0 -185
- package/src/components/value-props.tsx +0 -88
- package/src/constants/booking-guide-quiz.ts +0 -64
- package/src/constants/contact-info.ts +0 -2
- package/src/constants/faq.ts +0 -44
- package/src/constants/images.ts +0 -556
- package/src/constants/json-ld/faq-json-ld.tsx +0 -170
- package/src/constants/json-ld/homepage-json-ld.tsx +0 -138
- package/src/constants/json-ld/job-posting-json-ld.tsx +0 -92
- package/src/constants/json-ld/organization-json-ld.tsx +0 -62
- package/src/constants/json-ld/page-json-ld.tsx +0 -6
- package/src/constants/json-ld/product-json-ld.tsx +0 -154
- package/src/constants/json-ld/review-json-ld.tsx +0 -377
- package/src/constants/navigation-links/footer-links.ts +0 -48
- package/src/constants/navigation-links/nav-bar-links.ts +0 -41
- package/src/constants/navigation-links/navigation-link.ts +0 -6
- package/src/constants/pill-values.ts +0 -210
- package/src/constants/products.ts +0 -155
- package/src/constants/quiz-recommendations.ts +0 -506
- package/src/constants/reviews.ts +0 -75
- package/src/constants/staff.ts +0 -197
- package/src/constants/value-props.ts +0 -58
- package/src/data/dap-descriptions/session-couples-families-friends.en.json +0 -61
- package/src/data/dap-descriptions/session-elopements.en.json +0 -60
- package/src/data/dap-descriptions/session-proposals.en.json +0 -60
- package/src/data/product-descriptions/afternoon-delight.en.json +0 -35
- package/src/data/product-descriptions/emerald-lake-escape.en.json +0 -68
- package/src/data/product-descriptions/lake-louise-adventure.en.json +0 -74
- package/src/data/product-descriptions/moraine-lake-adventure.en.json +0 -78
- package/src/data/product-descriptions/moraine-lake-sunrise-lake-louise-golden-hour.en.json +0 -65
- package/src/data/product-descriptions/moraine-lake-sunrise.en.json +0 -64
- package/src/data/product-descriptions/private-tour.en.json +0 -80
- package/src/data/product-descriptions/two-lakes-combo.en.json +0 -65
- package/src/data/products-config.json +0 -101
- package/src/hooks/use-bottom-sheet.tsx +0 -15
- package/src/hooks/use-simple-modal.tsx +0 -27
- package/src/hooks/useBookingSourceMetadataFromLocation.ts +0 -21
- package/src/hooks/useEmailSubscription.tsx +0 -103
- package/src/hooks/useEmbeddedInIframe.ts +0 -16
- package/src/hooks/useIsBookingLaunchLive.ts +0 -49
- package/src/hooks/useQuiz.tsx +0 -210
- package/src/providers/bottom-sheet-provider.tsx +0 -40
- package/src/providers/dependent-add-on-dialog-provider.tsx +0 -105
- package/src/radius.css +0 -5
- package/src/spacing.css +0 -7
- package/src/strings/en.json +0 -1774
- package/src/strings/es.json +0 -1573
- package/src/strings/fr.json +0 -1573
- package/src/strings/index.js +0 -23
- package/src/text-style.css +0 -97
- package/src/types/fareharbor.d.ts +0 -12
- package/src/types/quiz.ts +0 -59
- package/src/utils/currency-converter.ts +0 -101
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import styles from './product-tag.module.css';
|
|
2
|
-
|
|
3
|
-
export enum ProductTagStyle {
|
|
4
|
-
MOST_POPULAR = 'MOST_POPULAR',
|
|
5
|
-
CUSTOM = 'CUSTOM',
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
interface ProductTagProps {
|
|
9
|
-
text: string;
|
|
10
|
-
style: ProductTagStyle;
|
|
11
|
-
backgroundColor?: string;
|
|
12
|
-
textColor?: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default function ProductTag({
|
|
16
|
-
text,
|
|
17
|
-
style,
|
|
18
|
-
backgroundColor,
|
|
19
|
-
textColor
|
|
20
|
-
}: ProductTagProps) {
|
|
21
|
-
const customStyles = style === ProductTagStyle.CUSTOM ? {
|
|
22
|
-
backgroundColor: backgroundColor || '#000000',
|
|
23
|
-
color: textColor || '#ffffff',
|
|
24
|
-
} : {};
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<div
|
|
28
|
-
className={`${styles.tag} ${styles[style.toLowerCase()]}`}
|
|
29
|
-
style={customStyles}
|
|
30
|
-
>
|
|
31
|
-
{text}
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
.bestOptionContainer {
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
align-items: center;
|
|
5
|
-
padding-top: var(--spacing-large);
|
|
6
|
-
padding-bottom: var(--spacing-large);
|
|
7
|
-
padding-left: var(--spacing-small);
|
|
8
|
-
padding-right: var(--spacing-small);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.otherOptionsRow {
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: row;
|
|
14
|
-
gap: 1rem;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.bestOptionProductsRowWrapper {
|
|
19
|
-
width: 100%;
|
|
20
|
-
max-width: 1200px;
|
|
21
|
-
margin: 0 auto;
|
|
22
|
-
display: flex;
|
|
23
|
-
flex-direction: column;
|
|
24
|
-
gap: 1rem;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.bestOptionProductsRow {
|
|
28
|
-
display: grid;
|
|
29
|
-
grid-template-columns: 1fr;
|
|
30
|
-
gap: 1rem;
|
|
31
|
-
width: 100%;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/* Tablet breakpoint - 2 tiles per row */
|
|
35
|
-
@media (min-width: 768px) {
|
|
36
|
-
.bestOptionProductsRow {
|
|
37
|
-
grid-template-columns: repeat(2, 1fr);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/* Desktop breakpoint - 3 tiles per row */
|
|
42
|
-
@media (min-width: 1024px) {
|
|
43
|
-
.bestOptionProductsRow {
|
|
44
|
-
display: flex;
|
|
45
|
-
flex-wrap: wrap;
|
|
46
|
-
justify-content: flex-start;
|
|
47
|
-
gap: 1rem;
|
|
48
|
-
max-width: 1200px;
|
|
49
|
-
margin: 0 auto;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.bestOptionProductsRow > * {
|
|
53
|
-
flex: 0 0 calc(33.333% - 0.67rem);
|
|
54
|
-
max-width: calc(33.333% - 0.67rem);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.bestOptionProductsRow > a {
|
|
59
|
-
text-decoration: none;
|
|
60
|
-
color: inherit;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.bestOptionBottomContainer {
|
|
64
|
-
padding-top: var(--spacing-large);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.bestOptionBottomTitle {
|
|
68
|
-
color: var(--primary-text);
|
|
69
|
-
font-size: 1.2rem;
|
|
70
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import defaultStrings from "@/strings";
|
|
4
|
-
import styles from "./best-option.module.css";
|
|
5
|
-
import { Product } from "@/constants/products";
|
|
6
|
-
import Link from "next/link";
|
|
7
|
-
import ProductTileCard from "../product-tile/product-tile-card";
|
|
8
|
-
|
|
9
|
-
export default function BestOption({ bestOptionProducts, otherProductThemePages, strings = defaultStrings }: { bestOptionProducts: Product[], otherProductThemePages: { title: string, path: string }[], strings?: any }) {
|
|
10
|
-
return (
|
|
11
|
-
<div className={styles.bestOptionContainer}>
|
|
12
|
-
{bestOptionProducts.length > 0 ? (
|
|
13
|
-
<>
|
|
14
|
-
<h2>{strings.productThemePages.bestOption.title}</h2>
|
|
15
|
-
<div className={styles.bestOptionProductsRowWrapper}>
|
|
16
|
-
<div className={styles.bestOptionProductsRow}>
|
|
17
|
-
{bestOptionProducts.map((product) => (
|
|
18
|
-
<ProductTileCard key={product.id} product={product} strings={strings} />
|
|
19
|
-
))}
|
|
20
|
-
</div>
|
|
21
|
-
</div>
|
|
22
|
-
</>
|
|
23
|
-
) : null}
|
|
24
|
-
|
|
25
|
-
<div className={styles.bestOptionBottomContainer}>
|
|
26
|
-
<h3 className={styles.bestOptionBottomTitle}>{strings.productThemePages.bestOption.bottomTitle}</h3>
|
|
27
|
-
<div className={styles.otherOptionsRow}>
|
|
28
|
-
{otherProductThemePages.map((page) => (
|
|
29
|
-
<Link href={page.path} key={page.title}>{page.title}</Link>
|
|
30
|
-
))}
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
.container {
|
|
2
|
-
border: 4px dashed var(--accent-turquoise-60);
|
|
3
|
-
padding: 1rem;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.description {
|
|
7
|
-
text-align: center;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@media (max-width: 1023px) {
|
|
11
|
-
.container {
|
|
12
|
-
margin: 0 auto;
|
|
13
|
-
width: 70%;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@media (min-width: 1024px) {
|
|
18
|
-
.container {
|
|
19
|
-
margin: 2rem auto;
|
|
20
|
-
width: 50%;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import styles from "./extended-tour-options.module.css";
|
|
2
|
-
import strings from "@/strings";
|
|
3
|
-
|
|
4
|
-
export default function ExtendedTourOptions() {
|
|
5
|
-
return (
|
|
6
|
-
<div className={styles.container}>
|
|
7
|
-
<h4>{strings.productThemePages.extendedTourOptions.title}</h4>
|
|
8
|
-
<p dangerouslySetInnerHTML={{ __html: strings.productThemePages.extendedTourOptions.description }} className={styles.description} />
|
|
9
|
-
</div>
|
|
10
|
-
)
|
|
11
|
-
}
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import { ImageData } from "@/constants/images";
|
|
2
|
-
import ViaViaImage from "@/components/image";
|
|
3
|
-
import styles from "./photo-gallery.module.css";
|
|
4
|
-
import { useEffect, useCallback, useRef, useState } from "react";
|
|
5
|
-
|
|
6
|
-
const SWIPE_THRESHOLD = 0.2; // 20% of width to trigger navigation
|
|
7
|
-
const DESKTOP_BREAKPOINT = 1024;
|
|
8
|
-
|
|
9
|
-
function useIsDesktop() {
|
|
10
|
-
const [isDesktop, setIsDesktop] = useState(true); // default to desktop (no swipe) to avoid flash
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
const mq = window.matchMedia(`(min-width: ${DESKTOP_BREAKPOINT}px)`);
|
|
13
|
-
setIsDesktop(mq.matches);
|
|
14
|
-
const handler = () => setIsDesktop(mq.matches);
|
|
15
|
-
mq.addEventListener("change", handler);
|
|
16
|
-
return () => mq.removeEventListener("change", handler);
|
|
17
|
-
}, []);
|
|
18
|
-
return isDesktop;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface ImageModalProps {
|
|
22
|
-
selectedImage: ImageData;
|
|
23
|
-
currentIndex: number;
|
|
24
|
-
totalImages: number;
|
|
25
|
-
/** Full images array - required for swipe-to-slide effect */
|
|
26
|
-
images: ImageData[];
|
|
27
|
-
onClose: () => void;
|
|
28
|
-
onNext: () => void;
|
|
29
|
-
onPrevious: () => void;
|
|
30
|
-
/** Override z-index for overlay (e.g. when inside a dialog with high z-index) */
|
|
31
|
-
overlayZIndex?: number;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default function ImageModal({
|
|
35
|
-
selectedImage,
|
|
36
|
-
currentIndex,
|
|
37
|
-
totalImages,
|
|
38
|
-
images,
|
|
39
|
-
onClose,
|
|
40
|
-
onNext,
|
|
41
|
-
onPrevious,
|
|
42
|
-
overlayZIndex = 1000,
|
|
43
|
-
}: ImageModalProps) {
|
|
44
|
-
const isDesktop = useIsDesktop();
|
|
45
|
-
const trackRef = useRef<HTMLDivElement>(null);
|
|
46
|
-
const containerRef = useRef<HTMLDivElement>(null);
|
|
47
|
-
const [dragOffset, setDragOffset] = useState(0);
|
|
48
|
-
const [containerWidth, setContainerWidth] = useState(400);
|
|
49
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
50
|
-
const touchStartX = useRef(0);
|
|
51
|
-
const touchStartOffset = useRef(0);
|
|
52
|
-
const dragOffsetRef = useRef(0);
|
|
53
|
-
dragOffsetRef.current = dragOffset;
|
|
54
|
-
|
|
55
|
-
const handleKeyDown = useCallback((e: KeyboardEvent) => {
|
|
56
|
-
switch (e.key) {
|
|
57
|
-
case 'Escape':
|
|
58
|
-
e.stopImmediatePropagation();
|
|
59
|
-
onClose();
|
|
60
|
-
break;
|
|
61
|
-
case 'ArrowLeft':
|
|
62
|
-
onPrevious();
|
|
63
|
-
break;
|
|
64
|
-
case 'ArrowRight':
|
|
65
|
-
onNext();
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
}, [onClose, onPrevious, onNext]);
|
|
69
|
-
|
|
70
|
-
const handleTouchStart = useCallback((e: React.TouchEvent) => {
|
|
71
|
-
touchStartX.current = e.touches[0].clientX;
|
|
72
|
-
touchStartOffset.current = dragOffset;
|
|
73
|
-
setIsDragging(true);
|
|
74
|
-
}, [dragOffset]);
|
|
75
|
-
|
|
76
|
-
const handleTouchMove = useCallback((e: React.TouchEvent) => {
|
|
77
|
-
if (!isDragging || !containerRef.current) return;
|
|
78
|
-
const delta = e.touches[0].clientX - touchStartX.current;
|
|
79
|
-
const containerWidth = containerRef.current.offsetWidth;
|
|
80
|
-
let newOffset = touchStartOffset.current + delta;
|
|
81
|
-
const maxDrag = containerWidth * 0.5;
|
|
82
|
-
if (currentIndex === 0 && newOffset > 0) newOffset = newOffset * 0.3;
|
|
83
|
-
else if (currentIndex === totalImages - 1 && newOffset < 0) newOffset = newOffset * 0.3;
|
|
84
|
-
else newOffset = Math.max(-maxDrag, Math.min(maxDrag, newOffset));
|
|
85
|
-
setDragOffset(newOffset);
|
|
86
|
-
}, [isDragging, currentIndex, totalImages]);
|
|
87
|
-
|
|
88
|
-
const handleTouchEnd = useCallback(() => {
|
|
89
|
-
if (!containerRef.current) return;
|
|
90
|
-
setIsDragging(false);
|
|
91
|
-
const width = containerRef.current.offsetWidth;
|
|
92
|
-
const offset = dragOffsetRef.current;
|
|
93
|
-
const threshold = width * SWIPE_THRESHOLD;
|
|
94
|
-
if (offset > threshold && currentIndex > 0) {
|
|
95
|
-
setDragOffset(0);
|
|
96
|
-
onPrevious();
|
|
97
|
-
} else if (offset < -threshold && currentIndex < totalImages - 1) {
|
|
98
|
-
setDragOffset(0);
|
|
99
|
-
onNext();
|
|
100
|
-
} else {
|
|
101
|
-
setDragOffset(0);
|
|
102
|
-
}
|
|
103
|
-
}, [currentIndex, totalImages, onNext, onPrevious]);
|
|
104
|
-
|
|
105
|
-
const handleMouseDown = useCallback((e: React.MouseEvent) => {
|
|
106
|
-
touchStartX.current = e.clientX;
|
|
107
|
-
touchStartOffset.current = dragOffset;
|
|
108
|
-
setIsDragging(true);
|
|
109
|
-
}, [dragOffset]);
|
|
110
|
-
|
|
111
|
-
useEffect(() => {
|
|
112
|
-
if (isDesktop) return;
|
|
113
|
-
const handleMouseMove = (e: MouseEvent) => {
|
|
114
|
-
if (!isDragging || !containerRef.current) return;
|
|
115
|
-
const delta = e.clientX - touchStartX.current;
|
|
116
|
-
const width = containerRef.current.offsetWidth;
|
|
117
|
-
let newOffset = touchStartOffset.current + delta;
|
|
118
|
-
const maxDrag = width * 0.5;
|
|
119
|
-
if (currentIndex === 0 && newOffset > 0) newOffset = newOffset * 0.3;
|
|
120
|
-
else if (currentIndex === totalImages - 1 && newOffset < 0) newOffset = newOffset * 0.3;
|
|
121
|
-
else newOffset = Math.max(-maxDrag, Math.min(maxDrag, newOffset));
|
|
122
|
-
setDragOffset(newOffset);
|
|
123
|
-
};
|
|
124
|
-
const handleMouseUp = () => {
|
|
125
|
-
if (!containerRef.current) return;
|
|
126
|
-
setIsDragging(false);
|
|
127
|
-
const width = containerRef.current.offsetWidth;
|
|
128
|
-
const offset = dragOffsetRef.current;
|
|
129
|
-
const threshold = width * SWIPE_THRESHOLD;
|
|
130
|
-
if (offset > threshold && currentIndex > 0) {
|
|
131
|
-
setDragOffset(0);
|
|
132
|
-
onPrevious();
|
|
133
|
-
} else if (offset < -threshold && currentIndex < totalImages - 1) {
|
|
134
|
-
setDragOffset(0);
|
|
135
|
-
onNext();
|
|
136
|
-
} else {
|
|
137
|
-
setDragOffset(0);
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
if (isDragging) {
|
|
141
|
-
window.addEventListener('mousemove', handleMouseMove);
|
|
142
|
-
window.addEventListener('mouseup', handleMouseUp);
|
|
143
|
-
}
|
|
144
|
-
return () => {
|
|
145
|
-
window.removeEventListener('mousemove', handleMouseMove);
|
|
146
|
-
window.removeEventListener('mouseup', handleMouseUp);
|
|
147
|
-
};
|
|
148
|
-
}, [isDesktop, isDragging, currentIndex, totalImages, onNext, onPrevious]);
|
|
149
|
-
|
|
150
|
-
useEffect(() => {
|
|
151
|
-
window.addEventListener('keydown', handleKeyDown, { capture: true });
|
|
152
|
-
return () => window.removeEventListener('keydown', handleKeyDown, { capture: true });
|
|
153
|
-
}, [handleKeyDown]);
|
|
154
|
-
|
|
155
|
-
useEffect(() => {
|
|
156
|
-
setDragOffset(0);
|
|
157
|
-
}, [currentIndex]);
|
|
158
|
-
|
|
159
|
-
useEffect(() => {
|
|
160
|
-
const el = containerRef.current;
|
|
161
|
-
if (!el) return;
|
|
162
|
-
const updateWidth = () => setContainerWidth(el.offsetWidth);
|
|
163
|
-
updateWidth();
|
|
164
|
-
const ro = new ResizeObserver(updateWidth);
|
|
165
|
-
ro.observe(el);
|
|
166
|
-
return () => ro.disconnect();
|
|
167
|
-
}, []);
|
|
168
|
-
|
|
169
|
-
const translateX = -currentIndex * containerWidth + dragOffset;
|
|
170
|
-
|
|
171
|
-
return (
|
|
172
|
-
<div
|
|
173
|
-
className={styles.modalOverlay}
|
|
174
|
-
onClick={onClose}
|
|
175
|
-
style={{ zIndex: overlayZIndex }}
|
|
176
|
-
>
|
|
177
|
-
<button className={styles.closeButton} onClick={onClose} aria-label="Close">
|
|
178
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
179
|
-
<path d="M18 6L6 18M6 6l12 12" />
|
|
180
|
-
</svg>
|
|
181
|
-
</button>
|
|
182
|
-
<button
|
|
183
|
-
className={`${styles.navButton} ${styles.prevButton}`}
|
|
184
|
-
onClick={(e) => {
|
|
185
|
-
e.stopPropagation();
|
|
186
|
-
onPrevious();
|
|
187
|
-
}}
|
|
188
|
-
disabled={currentIndex === 0}
|
|
189
|
-
aria-label="Previous image"
|
|
190
|
-
style={{ background: 'rgba(255,255,255,0.25)' }}
|
|
191
|
-
>
|
|
192
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
|
|
193
|
-
<path d="M15 18l-6-6 6-6" />
|
|
194
|
-
</svg>
|
|
195
|
-
</button>
|
|
196
|
-
<div
|
|
197
|
-
ref={containerRef}
|
|
198
|
-
className={`${styles.modalImageContainer} ${isDesktop ? styles.modalImageContainerDesktop : ''}`}
|
|
199
|
-
onTouchStart={handleTouchStart}
|
|
200
|
-
onTouchMove={handleTouchMove}
|
|
201
|
-
onTouchEnd={handleTouchEnd}
|
|
202
|
-
onTouchCancel={handleTouchEnd}
|
|
203
|
-
onMouseDown={isDesktop ? undefined : handleMouseDown}
|
|
204
|
-
onClick={(e) => e.stopPropagation()}
|
|
205
|
-
>
|
|
206
|
-
<div
|
|
207
|
-
ref={trackRef}
|
|
208
|
-
className={styles.modalImageTrack}
|
|
209
|
-
style={{
|
|
210
|
-
width: `${totalImages * 100}%`,
|
|
211
|
-
transform: `translateX(${translateX}px)`,
|
|
212
|
-
transition: isDragging ? 'none' : 'transform 0.3s ease-out',
|
|
213
|
-
}}
|
|
214
|
-
>
|
|
215
|
-
{images.map((img, i) => (
|
|
216
|
-
<div
|
|
217
|
-
key={img.id + i}
|
|
218
|
-
className={styles.modalImageSlide}
|
|
219
|
-
style={{ flex: `0 0 ${100 / totalImages}%` }}
|
|
220
|
-
>
|
|
221
|
-
<ViaViaImage
|
|
222
|
-
imageId={img.id}
|
|
223
|
-
alt={img.alt}
|
|
224
|
-
context="MODAL"
|
|
225
|
-
className={styles.modalImage}
|
|
226
|
-
maintainAspectRatio={true}
|
|
227
|
-
/>
|
|
228
|
-
</div>
|
|
229
|
-
))}
|
|
230
|
-
</div>
|
|
231
|
-
</div>
|
|
232
|
-
<button
|
|
233
|
-
className={`${styles.navButton} ${styles.nextButton}`}
|
|
234
|
-
onClick={(e) => {
|
|
235
|
-
e.stopPropagation();
|
|
236
|
-
onNext();
|
|
237
|
-
}}
|
|
238
|
-
disabled={currentIndex === totalImages - 1}
|
|
239
|
-
aria-label="Next image"
|
|
240
|
-
style={{ background: 'rgba(255,255,255,0.25)' }}
|
|
241
|
-
>
|
|
242
|
-
<svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
|
|
243
|
-
<path d="M9 18l6-6-6-6" />
|
|
244
|
-
</svg>
|
|
245
|
-
</button>
|
|
246
|
-
</div>
|
|
247
|
-
);
|
|
248
|
-
}
|
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
.photoGallery {
|
|
2
|
-
width: 100%;
|
|
3
|
-
max-width: 1200px;
|
|
4
|
-
margin: 2rem auto 0 auto; /* top right bottom left */
|
|
5
|
-
padding: 0 1rem;
|
|
6
|
-
box-sizing: border-box;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.grid {
|
|
10
|
-
display: grid;
|
|
11
|
-
gap: 1rem;
|
|
12
|
-
width: 100%;
|
|
13
|
-
box-sizing: border-box;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.photoItem {
|
|
17
|
-
position: relative;
|
|
18
|
-
width: 100%;
|
|
19
|
-
aspect-ratio: 1; /* Square aspect ratio */
|
|
20
|
-
cursor: zoom-in;
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.galleryImage {
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 100%;
|
|
27
|
-
object-fit: cover;
|
|
28
|
-
transition: all 0.3s ease;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@media (min-width: 1024px) {
|
|
32
|
-
.grid {
|
|
33
|
-
grid-template-columns: repeat(5, 1fr); /* 5 columns on large screens */
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.photoItem::after {
|
|
37
|
-
content: '';
|
|
38
|
-
position: absolute;
|
|
39
|
-
top: 0;
|
|
40
|
-
left: 0;
|
|
41
|
-
width: 100%;
|
|
42
|
-
height: 100%;
|
|
43
|
-
background-color: rgba(0, 0, 0, 0.2); /* Dark overlay */
|
|
44
|
-
transition: opacity 0.3s ease;
|
|
45
|
-
pointer-events: none;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.photoItem:hover::after {
|
|
49
|
-
opacity: 0; /* Fade out the overlay on hover */
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.navButton:hover {
|
|
53
|
-
opacity: 1;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
@media (max-width: 1023px) {
|
|
58
|
-
.grid {
|
|
59
|
-
grid-template-columns: repeat(3, 1fr); /* 3 columns on mobile */
|
|
60
|
-
gap: 0.5rem;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.photoGallery {
|
|
64
|
-
padding: 0 0.5rem;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.modalOverlay {
|
|
69
|
-
position: fixed;
|
|
70
|
-
top: 0;
|
|
71
|
-
left: 0;
|
|
72
|
-
right: 0;
|
|
73
|
-
bottom: 0;
|
|
74
|
-
background-color: rgba(0, 0, 0, 0.9);
|
|
75
|
-
display: flex;
|
|
76
|
-
justify-content: center;
|
|
77
|
-
align-items: center;
|
|
78
|
-
z-index: 1000;
|
|
79
|
-
cursor: zoom-out;
|
|
80
|
-
padding: 2rem;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.modalImageContainer {
|
|
84
|
-
position: relative;
|
|
85
|
-
width: 100%;
|
|
86
|
-
max-width: min(92vw, 1400px);
|
|
87
|
-
overflow: hidden;
|
|
88
|
-
overflow-x: clip;
|
|
89
|
-
touch-action: pan-y;
|
|
90
|
-
cursor: grab;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.modalImageContainer:active {
|
|
94
|
-
cursor: grabbing;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
.modalImageContainerDesktop {
|
|
98
|
-
cursor: default;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.modalImageContainerDesktop:active {
|
|
102
|
-
cursor: default;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.modalImageTrack {
|
|
106
|
-
display: flex;
|
|
107
|
-
will-change: transform;
|
|
108
|
-
flex-shrink: 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.modalImageSlide {
|
|
112
|
-
flex-shrink: 0;
|
|
113
|
-
min-width: 0;
|
|
114
|
-
display: flex;
|
|
115
|
-
justify-content: center;
|
|
116
|
-
align-items: center;
|
|
117
|
-
overflow: hidden;
|
|
118
|
-
width: 100%;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.modalImage {
|
|
122
|
-
display: flex !important;
|
|
123
|
-
justify-content: center !important;
|
|
124
|
-
align-items: center !important;
|
|
125
|
-
width: 100% !important;
|
|
126
|
-
margin: 0 auto !important;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.modalImage img {
|
|
130
|
-
max-width: min(92vw, 1400px) !important;
|
|
131
|
-
max-height: 85vh !important;
|
|
132
|
-
width: auto !important;
|
|
133
|
-
height: auto !important;
|
|
134
|
-
object-fit: contain !important;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.closeButton {
|
|
138
|
-
position: fixed;
|
|
139
|
-
top: 20px;
|
|
140
|
-
right: 20px;
|
|
141
|
-
display: flex;
|
|
142
|
-
align-items: center;
|
|
143
|
-
justify-content: center;
|
|
144
|
-
background: none;
|
|
145
|
-
border: none;
|
|
146
|
-
color: white;
|
|
147
|
-
cursor: pointer;
|
|
148
|
-
z-index: 1001;
|
|
149
|
-
padding: 12px;
|
|
150
|
-
outline: none !important;
|
|
151
|
-
-webkit-tap-highlight-color: transparent;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.navButton {
|
|
155
|
-
position: fixed;
|
|
156
|
-
top: 50%;
|
|
157
|
-
transform: translateY(-50%);
|
|
158
|
-
display: flex;
|
|
159
|
-
align-items: center;
|
|
160
|
-
justify-content: center;
|
|
161
|
-
width: 48px;
|
|
162
|
-
height: 48px;
|
|
163
|
-
background: rgba(255, 255, 255, 0.2);
|
|
164
|
-
border: none;
|
|
165
|
-
border-radius: 50%;
|
|
166
|
-
color: white;
|
|
167
|
-
cursor: pointer;
|
|
168
|
-
padding: 0;
|
|
169
|
-
opacity: 1;
|
|
170
|
-
transition: opacity 0.2s, background 0.2s;
|
|
171
|
-
z-index: 1002;
|
|
172
|
-
-webkit-tap-highlight-color: transparent;
|
|
173
|
-
user-select: none;
|
|
174
|
-
-webkit-touch-callout: none;
|
|
175
|
-
outline: none !important;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/* Only apply hover effect on desktop */
|
|
179
|
-
@media (min-width: 1024px) {
|
|
180
|
-
.navButton:hover {
|
|
181
|
-
opacity: 1;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
.navButton:disabled {
|
|
186
|
-
opacity: 0.3;
|
|
187
|
-
cursor: not-allowed;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.prevButton {
|
|
191
|
-
left: 16px;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.nextButton {
|
|
195
|
-
right: 16px;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.closeButton:hover {
|
|
199
|
-
opacity: 0.8;
|
|
200
|
-
}
|