Skip to content

Commit

Permalink
forgot some css vars in camel to snake case conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Oct 16, 2022
1 parent baf9db1 commit e8a4f4c
Show file tree
Hide file tree
Showing 41 changed files with 186 additions and 158 deletions.
26 changes: 13 additions & 13 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ body {
/* https://modern-fluid-typography.vercel.app */
font-size: clamp(1rem, 0.5vw + 1rem, 1.4rem);
transition: 0.3s;
background: var(--bodyBg);
color: var(--textColor);
background: var(--body-bg);
color: var(--text-color);
}
/* outer div = hydration target */
body > div {
Expand All @@ -51,20 +51,20 @@ main {
}
main h1 {
text-align: center;
color: var(--headingColor);
color: var(--heading-color);
}
main img {
width: 100%;
}
a {
color: var(--linkColor);
color: var(--link-color);
text-decoration: none;
}
a:hover {
color: var(--hoverColor);
color: var(--hover-color);
}
button {
color: var(--textColor);
color: var(--text-color);
background: transparent;
font-size: 1em;
border: none;
Expand All @@ -76,28 +76,28 @@ input,
select {
font-size: 1em;
border-radius: 5pt;
border: 1px solid var(--lightBg);
color: var(--textColor);
border: 1px solid var(--light-bg);
color: var(--text-color);
padding: 3pt 1ex;
max-width: 100%;
box-sizing: border-box;
}
blockquote {
border-left: 3pt solid var(--linkColor);
border-left: 3pt solid var(--link-color);
padding: 3pt 8pt;
background: var(--lightBg);
background: var(--light-bg);
margin: 1em 0;
}
table {
border-collapse: collapse;
width: 100%;
}
table :is(td, th) {
border: 1px solid var(--textColor);
border: 1px solid var(--text-color);
padding: 0.4em 0.8em;
}
tbody tr:nth-child(odd) {
background: var(--accentBg);
background: var(--accent-bg);
}
.grid {
display: grid;
Expand Down Expand Up @@ -167,7 +167,7 @@ tbody tr:nth-child(odd) {
background: var(--dark-orange);
}
.btn.stroke {
color: var(--textColor) !important;
color: var(--text-color) !important;
background: none;
}
.btn.stroke.blue {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/BasePage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
title=""
openButtonLabel="Inhaltsverzeichnis öffnen"
headingSelector="article :is(h2, h3, h4)"
--toc-mobile-bg="var(--bodyBg)"
--toc-mobile-bg="var(--body-bg)"
--toc-width="20em"
/>
{/if}
Expand Down
1 change: 1 addition & 0 deletions src/lib/ChapterMap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
display: inline-block;
border-radius: 50%;
border: 1px dashed white;
box-sizing: border-box;
vertical-align: text-bottom;
}
:global(a.chapter) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/CircleSpinner.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts">
export let color = `var(--textColor)`
export let color = `var(--text-color)`
export let duration = `1.5s`
export let size = `1em`
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Collapsible.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<style>
h3 {
cursor: pointer;
background: var(--lightBg);
background: var(--light-bg);
border-radius: 4pt;
padding: 4pt 1ex;
margin: 1em auto;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/Footer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
display: grid;
gap: 3em;
place-items: center;
background: var(--footerBg);
background: var(--footer-bg);
color: white;
}
footer :global(a) {
Expand Down
14 changes: 7 additions & 7 deletions src/lib/FormField.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@
noOptionsMsg="Keine passenden Optionen"
bind:selected={value}
{required}
--sms-options-bg="var(--accentBg)"
--sms-bg="var(--accentBg)"
--sms-options-bg="var(--accent-bg)"
--sms-bg="var(--accent-bg)"
--sms-height="3ex"
--sms-border="1px solid var(--lightBg)"
--sms-border="1px solid var(--light-bg)"
--sms-selected-bg="var(--green)"
--sms-selected-text-color="white"
--sms-min-height="32px"
Expand Down Expand Up @@ -108,9 +108,9 @@

<style>
/* TODO: remove this once svelte-multiselect@5.0.5 is out, for which
--sms-text-color="var(--textColor)" will be a simpler fix */
--sms-text-color="var(--text-color)" will be a simpler fix */
:global(div.multiselect ul.selected input) {
color: var(--textColor);
color: var(--text-color);
}
label {
display: block;
Expand All @@ -126,12 +126,12 @@
input {
display: block;
margin: 1em 0;
background: var(--accentBg);
background: var(--accent-bg);
width: 100%;
height: 32px;
}
input:focus {
border: 1px solid var(--linkColor);
border: 1px solid var(--link-color);
}
::-webkit-calendar-picker-indicator {
filter: invert(var(--invert));
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Geocoder.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
:global(.mapboxgl-ctrl-geocoder.mapboxgl-ctrl) {
width: 100%;
max-width: none;
background: var(--accentBg);
background: var(--accent-bg);
margin: 1em 0;
}
:global(.mapboxgl-ctrl-geocoder.mapboxgl-ctrl input) {
color: var(--textColor) !important;
color: var(--text-color) !important;
}
</style>
6 changes: 3 additions & 3 deletions src/lib/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<ThemeSwitcher />
<Search
{...searchProps}
--search-hits-bg-color="var(--bodyBg)"
--search-icon-color="var(--headerColor)"
--search-hits-bg-color="var(--body-bg)"
--search-icon-color="var(--header-color)"
--search-input-color="white"
/>
</header>
Expand All @@ -49,7 +49,7 @@
position: sticky;
top: 0;
font-weight: 300;
background: var(--headerBg);
background: var(--header-bg);
box-shadow: 0 0 1ex black;
z-index: 6; /* needed to stay above multiselect and range slider on signup page */
padding: 3pt 1ex;
Expand Down
57 changes: 48 additions & 9 deletions src/lib/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import mapboxgl from 'mapbox-gl'
import 'mapbox-gl/dist/mapbox-gl.css'
import { onMount } from 'svelte'
import type { MapMarker } from './types'
mapboxgl.accessToken = import.meta.env.VITE_MAPBOX_PUBLIC_KEY
Expand All @@ -15,15 +14,22 @@
export let maxZoom = 10
export let css = ``
let mapDiv: HTMLDivElement
let map_div: HTMLDivElement
type MapMarker = {
lng: number
lat: number
title: string
url?: string
classes?: string[]
}
// sort markers from north to south so southern makers have higher z-index
$: markers = markers.sort((m1, m2) => m2.lat - m1.lat)
onMount(() => {
map = new mapboxgl.Map({
cooperativeGestures: true,
container: mapDiv,
container: map_div,
style: `mapbox://styles/mapbox/outdoors-v11?optimize=true`,
center: [lng, lat],
zoom,
Expand All @@ -34,18 +40,18 @@
map.on(`load`, map.resize) // ensure map takes up full available width
for (const { lng, lat, title, url, classes } of markers) {
const anchor = document.createElement(`a`)
anchor.innerHTML = title.slice(0, 4)
anchor.href = url
anchor.classList.add(...classes)
const node = document.createElement(url ? `a` : `span`)
node.innerHTML = title
if (url) node.href = url
if (classes?.length) node.classList.add(...classes)
const marker = new mapboxgl.Marker(anchor, { anchor: `bottom`, offset: [0, -11] })
const marker = new mapboxgl.Marker(node, { anchor: `bottom`, offset: [0, -11] })
marker.setLngLat([lng, lat]).addTo(map)
}
})
</script>

<div bind:this={mapDiv} style={css} />
<div bind:this={map_div} style={css} />

<style>
div {
Expand All @@ -56,4 +62,37 @@
:global(.mapboxgl-ctrl-attrib-inner) {
display: none;
}
:global(a.chapter) {
color: white;
font-size: 12pt;
opacity: 0.9;
border-radius: 4pt;
padding: 0 3pt;
line-height: 14pt;
}
:global(a.chapter.active) {
background-color: var(--light-blue);
}
:global(a.chapter.starting) {
background-color: var(--dark-green);
}
:global(a.chapter:hover) {
background-color: var(--blue);
}
:global(a.chapter::after) {
content: '';
position: absolute;
left: 50%;
top: 100%;
transform: translate(-50%);
border: solid;
border-width: 8pt 4pt;
box-sizing: border-box;
}
:global(a.chapter.active::after) {
border-color: var(--light-blue) transparent transparent transparent;
}
:global(a.chapter.starting::after) {
border-color: var(--dark-green) transparent transparent transparent;
}
</style>
12 changes: 6 additions & 6 deletions src/lib/Nav.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@
}
a,
button {
color: var(--headerColor);
color: var(--header-color);
border-radius: 5pt;
padding: 0 3pt;
}
a:hover {
color: var(--hoverColor);
color: var(--hover-color);
}
a[aria-current] {
color: var(--orange);
Expand All @@ -147,7 +147,7 @@
list-style: none;
}
li::marker {
color: var(--headerColor);
color: var(--header-color);
}
nav {
overflow: auto;
Expand Down Expand Up @@ -179,7 +179,7 @@
padding: 1em;
transition: 0.4s;
max-height: calc(100vh - 2em);
background: var(--headerBg);
background: var(--header-bg);
transform: translate(-120%);
box-sizing: border-box;
overscroll-behavior: none;
Expand Down Expand Up @@ -209,7 +209,7 @@
}
nav.desktop > ul > li > ul {
position: absolute;
background: var(--headerBg);
background: var(--header-bg);
padding: 1ex 1em;
border-radius: 1ex;
box-shadow: 0 0 1em black;
Expand All @@ -222,7 +222,7 @@
}
nav.desktop > ul > li > ul > li.spanCols {
grid-column: 1/-1;
border-top: 1px solid var(--headerColor);
border-top: 1px solid var(--header-color);
padding-top: 6pt;
margin-top: 6pt;
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib/PlaceSelect.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script lang="ts">
import Icon from '@iconify/svelte'
import type { Result } from '@mapbox/mapbox-gl-geocoder'
import type { Map, Marker } from 'mapbox-gl'
import mapbox from 'mapbox-gl'
import type { Map } from 'mapbox-gl'
import { LngLatBounds, Marker } from 'mapbox-gl'
import Geocoder from './Geocoder.svelte'
import MapComp from './Map.svelte'
import type { Place } from './types'
Expand All @@ -29,12 +29,12 @@
value = [...(value ?? []), { address: place.place_name, lng, lat }]
const marker = new mapbox.Marker()
const marker = new Marker()
marker.setLngLat([lng, lat]).addTo(map)
markers = [...markers, marker]
const bounds = new mapbox.LngLatBounds([lng, lat], [lng, lat])
const bounds = new LngLatBounds([lng, lat], [lng, lat])
for (const marker of markers) {
bounds.extend(marker.getLngLat())
}
Expand Down Expand Up @@ -93,7 +93,7 @@
color: var(--gray);
}
input {
background: var(--accentBg);
background: var(--accent-bg);
width: 100%;
text-overflow: ellipsis;
height: 2em;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/PostPreview.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

<style>
section {
background: var(--accentBg);
background: var(--accent-bg);
border-radius: 1ex;
display: grid;
font-size: 0.9em;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/SearchHit.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<style>
div {
background: var(--accentBg);
background: var(--accent-bg);
padding: 1ex 1em;
border-radius: 5pt;
margin: 1em 0;
Expand Down
Loading

0 comments on commit e8a4f4c

Please sign in to comment.