Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(map): improve dark theme styles of map #18269

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion frontend/src/lib/components/Map/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import layers from 'protomaps-themes-base'
import useResizeObserver from 'use-resize-observer'

import 'maplibre-gl/dist/maplibre-gl.css'
import './Maplibre.scss'

import { themeLogic } from '~/layout/navigation-3000/themeLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
Expand Down Expand Up @@ -74,7 +75,7 @@ export function MapComponent({ center, markers, className }: MapProps): JSX.Elem
marker.addTo(map.current)
}
}
}, [])
}, [isDarkModeOn])

useResizeObserver({
ref: mapContainer,
Expand Down
29 changes: 29 additions & 0 deletions frontend/src/lib/components/Map/Maplibre.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
.maplibregl-ctrl-attrib-button:focus,
.maplibregl-ctrl-group button:focus {
box-shadow: 0 0 2px 2px var(--primary);
}

@media screen {
.maplibregl-ctrl-attrib.maplibregl-compact {
background-color: var(--bg-light);
color: var(--muted-3000);
}

.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-button {
background-color: var(--bg-3000);
[theme='dark'] & {
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");
}
}

.maplibregl-ctrl-attrib.maplibregl-compact-show .maplibregl-ctrl-attrib-button {
background-color: var(--bg-3000);
[theme='dark'] & {
background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='white' width='24' height='24' fill-rule='evenodd' viewBox='0 0 20 20'%3E%3Cpath d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/%3E%3C/svg%3E");
}
}

.maplibregl-ctrl-attrib a {
color: var(--text-3000);
}
}
Loading