diff --git a/src/assets/scss/_leaflet.scss b/src/assets/scss/_leaflet.scss index cf9864b4..100f7453 100644 --- a/src/assets/scss/_leaflet.scss +++ b/src/assets/scss/_leaflet.scss @@ -16,121 +16,6 @@ .leaflet-popup-content { min-width: 20rem; margin: 1rem; - - figure { - position: relative; - margin-inline: -1.1rem; - margin-top: -1.1rem; - margin-bottom: .5rem; - - &.landscape { - aspect-ratio: 16 / 9; - min-width: 20rem; - } - - &.portrait { - aspect-ratio: 15 / 16; - min-width: 10rem; - } - - &::before { - content: ''; - display: block; - pointer-events: none; - user-select: none; - position: absolute; - inset: 0; - z-index: 10; - // Make a linear gradient from top to bottom, from transparent to black - background: linear-gradient(to bottom, transparent 70%, var(--black) 100%); - } - - img { - width: 100%; - height: 100%; - object-fit: cover; - object-position: top; - } - - figcaption cite { - position: absolute; - font-size: 85%; - font-style: italic; - font-weight: 600; - bottom: .5rem; - right: 1rem; - color: var(--white); - z-index: 20; - opacity: .6; - transition-property: opacity; - transition-duration: .2s; - transition-timing-function: cubic-bezier(0.23, 1, 0.320, 1); - - a { - padding-right: 0; - color: var(--white); - text-decoration: underline; - text-underline-offset: .15rem; - - &:hover { - color: var(--blue-500); - } - - &::after { - display: none; - } - } - } - - &:hover { - figcaption cite { - opacity: 1; - } - } - } - - .title { - display: block; - font-weight: 600; - } - - strong.title { - color: var(--green-500); - } - - a.title, - a.map-link { - text-underline-offset: 2px; - text-decoration: underline; - - &:hover, - &:focus-visible { - text-decoration: none; - color: var(--green-500); - } - } - - .map-link { - display: inline-flex; - align-items: center; - gap: .5ch; - - svg { - width: 1rem; - height: 1rem; - } - } - - .tooltip-content > * + * { - margin: 0; - margin-top: .66em; - } - - .tooltip-footer { - display: grid; - gap: .15em; - font-size: .95em; - } } } @@ -139,6 +24,7 @@ height: .8rem; } } + .leaflet-tooltip-pane { .leaflet-tooltip { &.capital-name { diff --git a/src/components/maps/Map.astro b/src/components/maps/Map.astro index 812ccaed..4115249a 100644 --- a/src/components/maps/Map.astro +++ b/src/components/maps/Map.astro @@ -5,8 +5,7 @@ import MarkerCreator from './overlay/MarkerCreator.vue'; import { t } from '@/i18n/store'; import { getLangFromUrl } from '@/i18n/utils'; import { normalizeString } from '@/utils/Strings'; - -import CopyText from '../global/CopyText.astro'; +import MarkerContent from './MarkerContent.astro'; interface Props extends MapProps {} @@ -23,11 +22,6 @@ const { rulerHideWalkDistance = false, backgroundColor = 'transparent', } = Astro.props - -const lang = getLangFromUrl(Astro.url); - -const byText = t('common.by', lang) -const seeMapText = t('maps.go-to-map', lang) ---
@@ -39,39 +33,8 @@ const seeMapText = t('maps.go-to-map', lang)
{markers.map((m, index) => ( - @@ -87,9 +50,7 @@ const seeMapText = t('maps.go-to-map', lang) mapWidth, rulerDistanceRatio, rulerMainUnit, - rulerHideWalkDistance, - byText, - seeMapText + rulerHideWalkDistance }} defer > diff --git a/src/components/maps/MarkerContent.astro b/src/components/maps/MarkerContent.astro new file mode 100644 index 00000000..cb6b3e28 --- /dev/null +++ b/src/components/maps/MarkerContent.astro @@ -0,0 +1,176 @@ +--- +import type { MapMarker } from '@/types/Leaflet'; +import { normalizeString } from '@/utils/Strings'; +import { getLangFromUrl } from '@/i18n/utils'; +import { t } from '@/i18n/store'; + +import CopyText from '@/components/global/CopyText.astro'; + +interface Props { + marker: MapMarker +} + +const { marker: m } = Astro.props as Props; + +const lang = getLangFromUrl(Astro.url); + +const byText = t('common.by', lang) +const seeMapText = t('maps.go-to-map', lang) +--- + +
+ {m.cover && m.coverAuthor && m.coverLink && ( +
+ {m.title} +
+ + {byText} + + {m.coverAuthor} + + +
+
+ )} + {m.link ? ( + {m.title} + ) : ( + {m.title} + )} + {m.description &&

} + +

+
+ + \ No newline at end of file