From c60ea8e5daa9b7724159dd04810c78b853dc72d4 Mon Sep 17 00:00:00 2001 From: codecalm Date: Sun, 4 Oct 2026 17:32:59 +0200 Subject: [PATCH] Show the docs map examples with no padding --- docs/components/Example.astro | 6 ++++-- docs/content/ui/components/map.mdx | 20 ++++++++++---------- shared/components/demo/Map.astro | 6 ++++-- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/components/Example.astro b/docs/components/Example.astro index bef3dd00b..cfd962051 100644 --- a/docs/components/Example.astro +++ b/docs/components/Example.astro @@ -27,9 +27,11 @@ interface Props { columnFullWidth?: boolean hideCode?: boolean codeOnly?: boolean + /** no padding around the demo, for content that fills the whole area, such as a map */ + flush?: boolean } -const { html: htmlProp, code, raw, overflow = 'auto', background = 'surface-secondary', class: className, height, column, centered, vertical, columnFullWidth, hideCode, codeOnly } = Astro.props +const { html: htmlProp, code, raw, overflow = 'auto', background = 'surface-secondary', class: className, height, column, centered, vertical, columnFullWidth, hideCode, codeOnly, flush } = Astro.props const backgroundClasses: Record = { 'surface-secondary': 'bg-surface-secondary', @@ -52,7 +54,7 @@ const hasDemo = !codeOnly const hasCode = !hideCode const exampleClasses = ['example fs-base border', hasCode ? 'rounded-top' : 'rounded', !raw && 'd-flex flex-wrap justify-content-center', `overflow-${overflow}`, 'position-relative', backgroundClasses[background], className] -const innerClasses = ['p-6 w-full', column && 'd-flex gap-3 flex-column', !column && centered && `d-flex flex-fill flex-wrap gap-2 justify-content-center${vertical ? ' align-items-center flex-column' : ' justify-content-center'}`, columnFullWidth && 'd-flex flex-fill flex-column gap-2'] +const innerClasses = [flush ? 'p-0' : 'p-6', 'w-full', column && 'd-flex gap-3 flex-column', !column && centered && `d-flex flex-fill flex-wrap gap-2 justify-content-center${vertical ? ' align-items-center flex-column' : ' justify-content-center'}`, columnFullWidth && 'd-flex flex-fill flex-column gap-2'] const highlighted = hideCode ? '' : await highlightCode(beautifyHtml(code ?? html), 'html') --- diff --git a/docs/content/ui/components/map.mdx b/docs/content/ui/components/map.mdx index a550bc8f4..609d1bf27 100644 --- a/docs/content/ui/components/map.mdx +++ b/docs/content/ui/components/map.mdx @@ -98,8 +98,8 @@ document.addEventListener('DOMContentLoaded', function () { }) ``` - - + + `center` takes the longitude first and the latitude second. This is the opposite of what most map services show. @@ -116,8 +116,8 @@ Set `style` to the URL of any MapLibre style. OpenFreeMap has five of them: | `https://tiles.openfreemap.org/styles/bright` | Street map with stronger colors. | | `https://tiles.openfreemap.org/styles/fiord` | Dark blue map. | - - + + ### Map colors @@ -155,8 +155,8 @@ cities.forEach(function (coords) { }) ``` - - + + Without `element`, MapLibre draws its own pin. Its `color` option accepts a CSS variable, for example `var(--tblr-primary)`. @@ -184,8 +184,8 @@ pin.className = 'map-marker map-marker-pin map-marker-red' new maplibregl.Marker({ element: pin, anchor: 'bottom' }).setLngLat([13.47, 52.518]).addTo(map) ``` - - + +
Store
@@ -278,8 +278,8 @@ const popup = new maplibregl.Popup({ offset: 40, className: 'map-popup-card', ma new maplibregl.Marker({ element: pin, anchor: 'bottom' }).setLngLat([13.4019, 52.5169]).setPopup(popup).addTo(map) ``` - - + +