Skip to content

Commit

Permalink
Start a top bar for nav. Far from perfect, but looking much better! #15
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Feb 3, 2024
1 parent 8fb3416 commit f59ee5b
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 12 deletions.
Binary file added web/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion web/src/App.svelte
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script lang="ts">
import logo from "../assets/logo.png?url";
import "@picocss/pico/css/pico.min.css";
import initLtn from "backend";
import type { Map } from "maplibre-gl";
Expand All @@ -15,6 +16,7 @@
import {
app,
mapContents,
topContents,
map as mapStore,
mode,
sidebarContents,
Expand Down Expand Up @@ -42,8 +44,13 @@
);
}
let topDiv: HTMLDivElement;
let sidebarDiv: HTMLDivElement;
let mapDiv: HTMLDivElement;
$: if (topDiv && $topContents) {
topDiv.innerHTML = "";
topDiv.appendChild($topContents);
}
$: if (sidebarDiv && $sidebarContents) {
sidebarDiv.innerHTML = "";
sidebarDiv.appendChild($sidebarContents);
Expand All @@ -55,6 +62,14 @@
</script>

<Layout>
<div slot="top" style="display: flex">
<img
src={logo}
style="height: 8vh; margin-right: 20px;"
alt="A/B Street logo"
/>
<span bind:this={topDiv} />
</div>
<div slot="left">
<div bind:this={sidebarDiv} />

Expand All @@ -67,7 +82,7 @@
{/if}
<BasemapPicker />
</div>
<div slot="main" style="position:relative; width: 100%; height: 100vh;">
<div slot="main" style="position: relative; width: 100%; height: 100%;">
<MapLibre
style={$mapStyle}
standardControls
Expand Down
5 changes: 3 additions & 2 deletions web/src/NetworkMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
</script>

<SplitComponent>
<div slot="sidebar">
<div slot="top">
<nav aria-label="breadcrumb">
<!-- svelte-ignore a11y-invalid-attribute -->
<ul>
Expand All @@ -47,7 +47,8 @@
<li>Define neighbourhood boundaries</li>
</ul>
</nav>

</div>
<div slot="sidebar">
<nav>
<ul>
<li>
Expand Down
5 changes: 3 additions & 2 deletions web/src/RouteMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<svelte:window on:keydown={onKeyDown} />

<SplitComponent>
<div slot="sidebar">
<div slot="top">
<nav aria-label="breadcrumb">
<!-- svelte-ignore a11y-invalid-attribute -->
<ul>
Expand All @@ -64,7 +64,8 @@
<li>Routing</li>
</ul>
</nav>

</div>
<div slot="sidebar">
<button on:click={back}>Back</button>

<p>Drag markers for a route</p>
Expand Down
5 changes: 4 additions & 1 deletion web/src/SplitComponent.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
<script lang="ts">
import { mapContents, sidebarContents } from "./stores";
import { topContents, mapContents, sidebarContents } from "./stores";
// The kinda weird hack is that this must itself be nested underneath the
// MapLibre bit, so it has context. The sidebar is the "remote" part.
// TODO Maybe simplify accordingly
</script>

<div bind:this={$topContents}>
<slot name="top" />
</div>
<div bind:this={$sidebarContents}>
<slot name="sidebar" />
</div>
Expand Down
5 changes: 3 additions & 2 deletions web/src/ViewShortcutsMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<svelte:window on:keydown={onKeyDown} />

<SplitComponent>
<div slot="sidebar">
<div slot="top">
<nav aria-label="breadcrumb">
<!-- svelte-ignore a11y-invalid-attribute -->
<ul>
Expand All @@ -102,7 +102,8 @@
<li>Viewing shortcuts</li>
</ul>
</nav>

</div>
<div slot="sidebar">
<button on:click={back}>Back to editing</button>

{#if state.state == "neutral"}
Expand Down
12 changes: 11 additions & 1 deletion web/src/common/Layout.svelte
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<div class="top">
<slot name="top" />
</div>
<div class="left">
<slot name="left" />
</div>
Expand All @@ -10,13 +13,20 @@
float: left;
}
.top {
width: 100%;
height: 10vh;
}
.left {
width: 25%;
height: 100vh;
height: 90vh;
overflow: auto;
padding: 8px;
}
.main {
width: 75%;
height: 90vh;
}
</style>
5 changes: 3 additions & 2 deletions web/src/edit/NeighbourhoodMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
<svelte:window on:keydown={onKeyDown} />

<SplitComponent>
<div slot="sidebar">
<div slot="top">
<nav aria-label="breadcrumb">
<!-- svelte-ignore a11y-invalid-attribute -->
<ul>
Expand All @@ -122,7 +122,8 @@
</li>
</ul>
</nav>

</div>
<div slot="sidebar">
<nav>
<ul>
<li>
Expand Down
1 change: 1 addition & 0 deletions web/src/stores.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export let mapStyle: Writable<string> = writable(
export let example: Writable<string> = writable("");
export let showAbout: Writable<boolean> = writable(true);

export let topContents: Writable<HTMLDivElement | null> = writable(null);
export let sidebarContents: Writable<HTMLDivElement | null> = writable(null);
export let mapContents: Writable<HTMLDivElement | null> = writable(null);

Expand Down
4 changes: 3 additions & 1 deletion web/src/title/TitleMode.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
</script>

<SplitComponent>
<div slot="top">
<h1>Choose your study area</h1>
</div>
<div slot="sidebar">
<About />

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

{#if mapLoader}
Expand Down

0 comments on commit f59ee5b

Please sign in to comment.