From e29cb283dbc22d6d2ac2034a513350b7c9314a2a Mon Sep 17 00:00:00 2001 From: Erik Tiekstra Date: Wed, 29 Jan 2025 06:30:56 +0000 Subject: [PATCH] Merged in feat/SW-1455-static-map-on-destination-pages (pull request #1223) feat(SW-1455): Added static map component with button to open dynamic map * feat(SW-1455): Added static map component with button to open dynamic map Approved-by: Fredrik Thorsson --- .../destinationCityPage.module.css | 13 ------ .../DestinationCityPage/index.tsx | 12 +---- .../destinationCountryPage.module.css | 13 ------ .../DestinationCountryPage/index.tsx | 12 +---- .../DestinationPage/StaticMap/index.tsx | 46 +++++++++++++++++++ .../StaticMap/staticMap.module.css | 19 ++++++++ 6 files changed, 69 insertions(+), 46 deletions(-) create mode 100644 components/ContentType/DestinationPage/StaticMap/index.tsx create mode 100644 components/ContentType/DestinationPage/StaticMap/staticMap.module.css diff --git a/components/ContentType/DestinationPage/DestinationCityPage/destinationCityPage.module.css b/components/ContentType/DestinationPage/DestinationCityPage/destinationCityPage.module.css index 58ba82047..f2ba79648 100644 --- a/components/ContentType/DestinationPage/DestinationCityPage/destinationCityPage.module.css +++ b/components/ContentType/DestinationPage/DestinationCityPage/destinationCityPage.module.css @@ -33,19 +33,6 @@ flex-wrap: wrap; } -.mapWrapper { - width: 100%; - height: 200px; - display: flex; - justify-content: center; - align-items: center; -} - -.mapWrapper img { - border-radius: var(--Corner-radius-Large); - overflow: hidden; -} - @media screen and (min-width: 768px) { .pageContainer { max-width: var(--max-width-page); diff --git a/components/ContentType/DestinationPage/DestinationCityPage/index.tsx b/components/ContentType/DestinationPage/DestinationCityPage/index.tsx index 4988714a7..ccd5ceecb 100644 --- a/components/ContentType/DestinationPage/DestinationCityPage/index.tsx +++ b/components/ContentType/DestinationPage/DestinationCityPage/index.tsx @@ -3,7 +3,6 @@ import { Suspense } from "react" import { getDestinationCityPage } from "@/lib/trpc/memoizedRequests" import Breadcrumbs from "@/components/Breadcrumbs" -import StaticMap from "@/components/Maps/StaticMap" import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton" import Chip from "@/components/TempDesignSystem/Chip" import Body from "@/components/TempDesignSystem/Text/Body" @@ -13,6 +12,7 @@ import { getIntl } from "@/i18n" import SidebarContentWrapper from "../SidebarContentWrapper" import DestinationPageSidePeek from "../Sidepeek" +import StaticMap from "../StaticMap" import TopImages from "../TopImages" import { mapExperiencesToListData } from "../utils" @@ -78,15 +78,7 @@ export default async function DestinationCityPage() { )} {destination_settings.city && ( -
- -
+ )} diff --git a/components/ContentType/DestinationPage/DestinationCountryPage/destinationCountryPage.module.css b/components/ContentType/DestinationPage/DestinationCountryPage/destinationCountryPage.module.css index 58ba82047..f2ba79648 100644 --- a/components/ContentType/DestinationPage/DestinationCountryPage/destinationCountryPage.module.css +++ b/components/ContentType/DestinationPage/DestinationCountryPage/destinationCountryPage.module.css @@ -33,19 +33,6 @@ flex-wrap: wrap; } -.mapWrapper { - width: 100%; - height: 200px; - display: flex; - justify-content: center; - align-items: center; -} - -.mapWrapper img { - border-radius: var(--Corner-radius-Large); - overflow: hidden; -} - @media screen and (min-width: 768px) { .pageContainer { max-width: var(--max-width-page); diff --git a/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx b/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx index 971cd54d9..050cb23be 100644 --- a/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx +++ b/components/ContentType/DestinationPage/DestinationCountryPage/index.tsx @@ -3,7 +3,6 @@ import { Suspense } from "react" import { getDestinationCountryPage } from "@/lib/trpc/memoizedRequests" import Breadcrumbs from "@/components/Breadcrumbs" -import StaticMap from "@/components/Maps/StaticMap" import BreadcrumbsSkeleton from "@/components/TempDesignSystem/Breadcrumbs/BreadcrumbsSkeleton" import Chip from "@/components/TempDesignSystem/Chip" import Body from "@/components/TempDesignSystem/Text/Body" @@ -13,6 +12,7 @@ import { getIntl } from "@/i18n" import SidebarContentWrapper from "../SidebarContentWrapper" import DestinationPageSidePeek from "../Sidepeek" +import StaticMap from "../StaticMap" import TopImages from "../TopImages" import { mapExperiencesToListData } from "../utils" @@ -77,15 +77,7 @@ export default async function DestinationCountryPage() { /> )} -
- -
+ diff --git a/components/ContentType/DestinationPage/StaticMap/index.tsx b/components/ContentType/DestinationPage/StaticMap/index.tsx new file mode 100644 index 000000000..fafdd3669 --- /dev/null +++ b/components/ContentType/DestinationPage/StaticMap/index.tsx @@ -0,0 +1,46 @@ +import { MapIcon } from "@/components/Icons" +import StaticMap from "@/components/Maps/StaticMap" +import Button from "@/components/TempDesignSystem/Button" +import { getIntl } from "@/i18n" + +import styles from "./staticMap.module.css" + +interface StaticMapProps { + country?: string + city?: string +} + +export default async function DestinationStaticMap({ + country, + city, +}: StaticMapProps) { + const intl = await getIntl() + const altText = city + ? intl.formatMessage({ id: "Map of the city" }) + : intl.formatMessage({ id: "Map of the country" }) + const zoomLevel = city ? 10 : 3 + + return ( +
+ + +
+ ) +} diff --git a/components/ContentType/DestinationPage/StaticMap/staticMap.module.css b/components/ContentType/DestinationPage/StaticMap/staticMap.module.css new file mode 100644 index 000000000..ac9722ebf --- /dev/null +++ b/components/ContentType/DestinationPage/StaticMap/staticMap.module.css @@ -0,0 +1,19 @@ +.mapWrapper { + position: relative; + width: 100%; + height: 200px; + display: flex; + justify-content: center; + align-items: center; +} + +.mapWrapper img { + border-radius: var(--Corner-radius-Large); + overflow: hidden; +} + +.button { + position: absolute; + right: var(--Spacing-x2); + bottom: var(--Spacing-x2); +}