Skip to content

Commit f59ee5b

Browse files
committed
Start a top bar for nav. Far from perfect, but looking much better! #15
1 parent 8fb3416 commit f59ee5b

10 files changed

+47
-12
lines changed

web/assets/logo.png

13.4 KB
Loading

web/src/App.svelte

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import logo from "../assets/logo.png?url";
23
import "@picocss/pico/css/pico.min.css";
34
import initLtn from "backend";
45
import type { Map } from "maplibre-gl";
@@ -15,6 +16,7 @@
1516
import {
1617
app,
1718
mapContents,
19+
topContents,
1820
map as mapStore,
1921
mode,
2022
sidebarContents,
@@ -42,8 +44,13 @@
4244
);
4345
}
4446
47+
let topDiv: HTMLDivElement;
4548
let sidebarDiv: HTMLDivElement;
4649
let mapDiv: HTMLDivElement;
50+
$: if (topDiv && $topContents) {
51+
topDiv.innerHTML = "";
52+
topDiv.appendChild($topContents);
53+
}
4754
$: if (sidebarDiv && $sidebarContents) {
4855
sidebarDiv.innerHTML = "";
4956
sidebarDiv.appendChild($sidebarContents);
@@ -55,6 +62,14 @@
5562
</script>
5663

5764
<Layout>
65+
<div slot="top" style="display: flex">
66+
<img
67+
src={logo}
68+
style="height: 8vh; margin-right: 20px;"
69+
alt="A/B Street logo"
70+
/>
71+
<span bind:this={topDiv} />
72+
</div>
5873
<div slot="left">
5974
<div bind:this={sidebarDiv} />
6075

@@ -67,7 +82,7 @@
6782
{/if}
6883
<BasemapPicker />
6984
</div>
70-
<div slot="main" style="position:relative; width: 100%; height: 100vh;">
85+
<div slot="main" style="position: relative; width: 100%; height: 100%;">
7186
<MapLibre
7287
style={$mapStyle}
7388
standardControls

web/src/NetworkMode.svelte

+3-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</script>
3636

3737
<SplitComponent>
38-
<div slot="sidebar">
38+
<div slot="top">
3939
<nav aria-label="breadcrumb">
4040
<!-- svelte-ignore a11y-invalid-attribute -->
4141
<ul>
@@ -47,7 +47,8 @@
4747
<li>Define neighbourhood boundaries</li>
4848
</ul>
4949
</nav>
50-
50+
</div>
51+
<div slot="sidebar">
5152
<nav>
5253
<ul>
5354
<li>

web/src/RouteMode.svelte

+3-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<svelte:window on:keydown={onKeyDown} />
4141

4242
<SplitComponent>
43-
<div slot="sidebar">
43+
<div slot="top">
4444
<nav aria-label="breadcrumb">
4545
<!-- svelte-ignore a11y-invalid-attribute -->
4646
<ul>
@@ -64,7 +64,8 @@
6464
<li>Routing</li>
6565
</ul>
6666
</nav>
67-
67+
</div>
68+
<div slot="sidebar">
6869
<button on:click={back}>Back</button>
6970

7071
<p>Drag markers for a route</p>

web/src/SplitComponent.svelte

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
<script lang="ts">
2-
import { mapContents, sidebarContents } from "./stores";
2+
import { topContents, mapContents, sidebarContents } from "./stores";
33
44
// The kinda weird hack is that this must itself be nested underneath the
55
// MapLibre bit, so it has context. The sidebar is the "remote" part.
66
// TODO Maybe simplify accordingly
77
</script>
88

9+
<div bind:this={$topContents}>
10+
<slot name="top" />
11+
</div>
912
<div bind:this={$sidebarContents}>
1013
<slot name="sidebar" />
1114
</div>

web/src/ViewShortcutsMode.svelte

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<svelte:window on:keydown={onKeyDown} />
8383

8484
<SplitComponent>
85-
<div slot="sidebar">
85+
<div slot="top">
8686
<nav aria-label="breadcrumb">
8787
<!-- svelte-ignore a11y-invalid-attribute -->
8888
<ul>
@@ -102,7 +102,8 @@
102102
<li>Viewing shortcuts</li>
103103
</ul>
104104
</nav>
105-
105+
</div>
106+
<div slot="sidebar">
106107
<button on:click={back}>Back to editing</button>
107108

108109
{#if state.state == "neutral"}

web/src/common/Layout.svelte

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<div class="top">
2+
<slot name="top" />
3+
</div>
14
<div class="left">
25
<slot name="left" />
36
</div>
@@ -10,13 +13,20 @@
1013
float: left;
1114
}
1215
16+
.top {
17+
width: 100%;
18+
height: 10vh;
19+
}
20+
1321
.left {
1422
width: 25%;
15-
height: 100vh;
23+
height: 90vh;
1624
overflow: auto;
1725
padding: 8px;
1826
}
27+
1928
.main {
2029
width: 75%;
30+
height: 90vh;
2131
}
2232
</style>

web/src/edit/NeighbourhoodMode.svelte

+3-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
<svelte:window on:keydown={onKeyDown} />
102102

103103
<SplitComponent>
104-
<div slot="sidebar">
104+
<div slot="top">
105105
<nav aria-label="breadcrumb">
106106
<!-- svelte-ignore a11y-invalid-attribute -->
107107
<ul>
@@ -122,7 +122,8 @@
122122
</li>
123123
</ul>
124124
</nav>
125-
125+
</div>
126+
<div slot="sidebar">
126127
<nav>
127128
<ul>
128129
<li>

web/src/stores.ts

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export let mapStyle: Writable<string> = writable(
4343
export let example: Writable<string> = writable("");
4444
export let showAbout: Writable<boolean> = writable(true);
4545

46+
export let topContents: Writable<HTMLDivElement | null> = writable(null);
4647
export let sidebarContents: Writable<HTMLDivElement | null> = writable(null);
4748
export let mapContents: Writable<HTMLDivElement | null> = writable(null);
4849

web/src/title/TitleMode.svelte

+3-1
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,12 @@
4646
</script>
4747

4848
<SplitComponent>
49+
<div slot="top">
50+
<h1>Choose your study area</h1>
51+
</div>
4952
<div slot="sidebar">
5053
<About />
5154

52-
<h1>Choose your study area</h1>
5355
<button on:click={() => ($showAbout = true)}>About the LTN tool</button>
5456

5557
{#if mapLoader}

0 commit comments

Comments
 (0)