Add interactive Leaflet map component for blog posts - #85
Draft
khou22 wants to merge 1 commit into
Draft
Conversation
Introduces a reusable, client-only Leaflet map that can be embedded in blog posts via a custom <leaflet-map> HTML tag (parsed by CustomMarkdown). Pins support four marker styles: emoji, colored dot, text label, and built-in vector icons, plus optional hover tooltips and click popups. Maps auto-fit to pin bounds when no center is given. - src/components/organisms/LeafletMap: core map, icon builder, SSR-safe dynamic embed wrapper, types, and usage README - CustomMarkdown: register the <leaflet-map> tag - add leaflet, react-leaflet, @types/leaflet deps https://claude.ai/code/session_018vFehYnKPKTShwxwWsV4PR
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces a new interactive Leaflet map component that can be embedded in blog posts via a custom
<leaflet-map>HTML tag or used directly in React components. The map supports fully customizable markers (emoji, colored dots, text labels, or built-in vector icons) with optional hover tooltips and click popups.Key Changes
LeafletMap.tsx): Core interactive map using react-leaflet with support for custom pins, auto-fitting to pin bounds, and configurable tile layersicons.ts): Creates Leaflet DivIcons for four marker types:LeafletMapEmbed.tsx): Dynamically loads the map withssr: falsesince Leaflet accesseswindowat import time. Parses HTML attributes from markdown<leaflet-map>tags and converts them to typed propstypes.ts): Serializable types forMapPin,PinIcon, andLeafletMapPropsto support both React and HTML attribute-based configurationLeafletMapEmbedas a custom component handler inCustomMarkdownto support embedded maps in blog postsREADME.md): Comprehensive guide with examples for both markdown embedding and direct React usageNotable Implementation Details
https://claude.ai/code/session_018vFehYnKPKTShwxwWsV4PR