Skip to content

LeafletMap Component Implementation Summary

Date: October 16, 2025
Branch: feat/component-layering
Division: Pride City
Component: LeafletMap

Successfully implemented the Pagedone “Leaflet Map With Custom Pin” component as a division-specific component for the Pride City app division, following the established component layering architecture.

  • Added leaflet@1.9.4 to workspace root package.json dependencies
  • Added @types/leaflet@1.9.21 to workspace root devDependencies
  • Followed AI safety protocol for all terminal operations
  • Installed at monorepo root level (not division level) per best practices

Created packages/ui-pride-city/src/components/LeafletMap/ with:

LeafletMap.tsx

  • React functional component with TypeScript
  • Props interface with full JSDoc documentation
  • OpenStreetMap tile integration
  • Custom marker support with popup text
  • Custom icon support (optional)
  • Configurable center, zoom, height
  • Proper cleanup on unmount
  • Accessible with data-testid attribute

index.ts

  • Barrel export for component and types

README.md

  • Comprehensive usage documentation
  • Props API reference table
  • Code examples
  • Storybook references
  • Attribution notes
  • Division-specific usage guidelines

Updated packages/ui-pride-city/src/index.ts:

  • Added export for LeafletMap component
  • Component now available via @cloudalt-frontend/ui-pride-city

Created packages/storybook/stories/LeafletMap.stories.tsx with 7 stories:

  1. Default - Basic map centered on London
  2. WithCustomMarkers - Multiple Pride City locations with popups
  3. SanFrancisco - Castro District and LGBTQ+ landmarks
  4. NewYorkCity - Stonewall Inn and Christopher Street
  5. CustomHeight - 600px tall map example
  6. ZoomedOut - Area overview at zoom level 8
  7. ZoomedIn - Street detail at zoom level 16

All stories under: Pride City/Components/LeafletMap

  • Ran yarn build-storybook successfully
  • No TypeScript errors
  • No lint errors
  • Component CSS properly bundled
  • All stories render correctly

Committed with descriptive message:

feat(pride-city): add LeafletMap component with custom pin support
  • ✅ Division-specific component (not core)
  • ✅ Lives in packages/ui-pride-city
  • ✅ Dependencies installed at workspace root
  • ✅ Follows established patterns from other division packages
  • ✅ Storybook integration matches existing patterns
  • Interactive map with pan and zoom
  • OpenStreetMap tiles (free, open-source)
  • Custom marker positioning with lat/lng coordinates
  • Optional popup text for each marker
  • Custom icon support
  • Responsive container with configurable height
  • TypeScript-first with full type safety
  • Proper cleanup to prevent memory leaks
{
"dependencies": {
"leaflet": "^1.9.4"
},
"devDependencies": {
"@types/leaflet": "^1.9.21"
}
}

Installed at workspace root per monorepo best practices, not at package level.

import { LeafletMap } from '@cloudalt-frontend/ui-pride-city';
<LeafletMap
center={[37.7749, -122.4194]}
zoom={13}
height="500px"
markers={[
[37.7749, -122.4194, 'Castro District'],
[37.7699, -122.4353, 'Twin Peaks'],
]}
/>

Component automatically works with existing Storybook infrastructure:

  • Division: Select “Pride City” to view
  • App: Select “Pride City App” for brand theming
  • Theme: Toggle light/dark modes
  • Component respects brand CSS variables from roomlgbt brand
  • packages/ui-pride-city/src/components/LeafletMap/LeafletMap.tsx
  • packages/ui-pride-city/src/components/LeafletMap/index.ts
  • packages/ui-pride-city/src/components/LeafletMap/README.md
  • packages/storybook/stories/LeafletMap.stories.tsx
  • Storybook build artifacts in storybook-static/
  • package.json (root dependencies)
  • packages/ui-pride-city/src/index.ts (exports)
  • yarn.lock (dependency resolution)

To verify the component works:

  1. View in Storybook:

    Terminal window
    yarn storybook

    Navigate to: Pride City → Components → LeafletMap

  2. Use in Pride City App:

    import { LeafletMap } from '@cloudalt-frontend/ui-pride-city';
  3. Check TypeScript:

    Terminal window
    yarn typecheck
  • Add geocoding support (address → coordinates)
  • Add marker clustering for many markers
  • Add routing/directions support
  • Add custom map styles/themes
  • Add mobile gesture controls
  • Add accessibility improvements (keyboard nav)

If other divisions need mapping, consider:

  1. Promoting to @cloudalt-frontend/ui-web (core layer)
  2. Creating division-specific variants with preset locations
  3. Adding brand-specific map styling

All terminal operations followed docs/ai-directory-safety-protocol.md:

  • ✅ Used absolute paths for all directory navigation
  • ✅ Verified location with pwd before commands
  • ✅ Explicit cd to workspace root with confirmation
  • ✅ No assumptions about working directory

This implementation demonstrates the three-tier architecture:

Core Layer (ui, ui-web)
Division Layer (ui-pride-city) ← LeafletMap lives here
App Layer (app/components overrides)

LeafletMap is correctly positioned as a division-specific component because:

  • It’s intended for Pride City apps specifically
  • Location examples are LGBTQ+ community-focused
  • Not yet proven to be needed across all divisions
  • Can be promoted to core later if widely adopted

✅ Component built and type-safe
✅ Storybook stories render correctly
✅ Dependencies installed at correct level
✅ Follows established patterns
✅ Documentation complete
✅ No build/lint errors
✅ Git committed with clear message
✅ AI safety protocol followed