Skip to content

Commit

Permalink
Followup multi level dropdown (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
aparlato authored Aug 20, 2024
1 parent b8f8e62 commit 980241e
Show file tree
Hide file tree
Showing 13 changed files with 464 additions and 300 deletions.
12 changes: 6 additions & 6 deletions dist/bundle.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"sirv-cli": "^1.0.0",
"stamen-attribution": "github:stamen/stamen-attribution#v0.1.0",
"svelte-fa": "^2.4.0",
"sveltestrap": "^5.11.3",
"tangram": "^0.21.1"
},
"main": "dist/bundle.js"
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@
margin-bottom: 2em;
width: auto;
max-width: calc(100% - 6em);
min-width: 240px;
min-width: 300px;
}
.highlight-diff {
Expand Down
21 changes: 13 additions & 8 deletions src/components/MapLocationDropdown.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script>
import { createEventDispatcher } from 'svelte';
import { config as configStore } from '../stores';
import SimpleDropdown from './inputs/SimpleDropdown.svelte';
import Dropdown from './inputs/Dropdown/Dropdown.svelte';
export let bearing;
export let center;
Expand Down Expand Up @@ -97,14 +97,19 @@
</script>
{#if gazetteer}
<SimpleDropdown
placeholder={'Go to...'}
options={selectionOptions}
value={selected}
onClick={onSelect}
direction="down"
/>
<div class="dropdown-container">
<Dropdown
placeholder={'Go to...'}
options={selectionOptions}
activeValue={selected}
{onSelect}
direction="down"
/>
</div>
{/if}
<style>
.dropdown-container {
min-width: 140px;
}
</style>
19 changes: 14 additions & 5 deletions src/components/MapStyleInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import { shortcut } from '../shortcut';
import { fetchUrl } from '../fetch-url';
import StylesDropdown from './inputs/StylesDropdown.svelte';
import SimpleDropdown from './inputs/SimpleDropdown.svelte';
import Dropdown from './inputs/Dropdown/Dropdown.svelte';
const dispatch = createEventDispatcher();
export let dropdownDisplayOptions;
Expand Down Expand Up @@ -228,10 +229,10 @@
<div class="renderer-control">
<span class="nowrap">Rendered with</span>
<SimpleDropdown
<Dropdown
options={rendererOptions.map(v => ({ label: v.name, value: v.value }))}
value={rendererValue}
onClick={v => dispatch('selectRenderer', { value: v })}
activeValue={rendererValue}
onSelect={v => dispatch('selectRenderer', { value: v })}
direction="up"
/>
</div>
Expand All @@ -243,11 +244,19 @@
display: flex;
flex-direction: column;
gap: 0.25rem;
max-width: 240px;
max-width: 300px;
}
.custom-input {
margin-top: 0px;
display: flex;
flex-wrap: nowrap;
gap: 0.25rem;
}
.custom-input input {
flex-grow: 1;
width: 0;
}
.input-error:focus {
Expand Down
16 changes: 11 additions & 5 deletions src/components/ViewModeControl.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { createEventDispatcher } from 'svelte';
import { linkLocations as linkLocationsStore } from '../stores';
import { VIEW_MODES } from '../constants';
import SimpleDropdown from './inputs/SimpleDropdown.svelte';
import Dropdown from './inputs/Dropdown/Dropdown.svelte';
export let mode;
export let mapsNum;
Expand Down Expand Up @@ -67,11 +67,17 @@
};
</script>

<div>
<SimpleDropdown
<div class="dropdown-container">
<Dropdown
options={viewModes.map(v => ({ label: v, value: v }))}
value={selectedMode}
onClick={onSelect}
activeValue={selectedMode}
{onSelect}
direction="down"
/>
</div>

<style>
.dropdown-container {
min-width: 100px;
}
</style>
Loading

0 comments on commit 980241e

Please sign in to comment.