-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(mapper): feature legend & layer-switcher (#2107)
* fix(bottom-sheet): adjust z-index * refactor(main): seperate map control symbol and component * refactor(legend): show feature level legend and refactor accordingly * refactor(layer-switcher): remove basemap toggle icon, refactor accordingly * fix(legend): update legend heading
- Loading branch information
Showing
4 changed files
with
120 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,29 @@ | ||
<script lang="ts"> | ||
import '$styles/page.css'; | ||
import { clickOutside } from '$lib/utils/clickOutside.ts'; | ||
import LockImg from '$assets/images/black-lock.png'; | ||
type taskStatusesType = { status: string; color?: string; icon?: string }; | ||
let isOpen = $state(false); | ||
type taskStatusesType = { status: string; color: string }; | ||
type Props = { | ||
isOpen: boolean; | ||
}; | ||
const { isOpen }: Props = $props(); | ||
const taskStatuses: taskStatusesType[] = [ | ||
{ status: 'Ready', color: '#ffffff' }, | ||
{ status: 'Locked For Mapping', color: '#008099' }, | ||
{ status: 'Ready For Validation', color: '#ade6ef' }, | ||
{ status: 'Locked For Validation', color: '#fceca4' }, | ||
{ status: 'Validated', color: '#40ac8c' }, | ||
{ status: 'More Mapping Needed', color: '#d73f3e' }, | ||
{ status: 'Locked', icon: LockImg }, | ||
{ status: 'Ready', color: '#9c9a9a' }, | ||
{ status: 'Opened in ODK', color: '#fae15f' }, | ||
{ status: 'Survey Submitted', color: '#71bf86' }, | ||
{ status: 'Marked Bad', color: '#fa1100' }, | ||
]; | ||
</script> | ||
|
||
<div use:clickOutside onclick_outside={() => (isOpen = false)} class="relative font-barlow"> | ||
<div | ||
aria-label="toggle legend" | ||
class="group text-nowrap cursor-pointer" | ||
onclick={() => (isOpen = !isOpen)} | ||
role="button" | ||
onkeydown={(e) => { | ||
if (e.key === 'Enter') { | ||
isOpen = !isOpen; | ||
} | ||
}} | ||
tabindex="0" | ||
> | ||
<hot-icon | ||
style="border: 1px solid #D7D7D7;" | ||
name="legend-toggle" | ||
class={`!text-[1.7rem] text-[#333333] bg-white p-1 rounded-full group-hover:text-red-600 duration-200 ${isOpen && 'text-red-600'}`} | ||
></hot-icon> | ||
</div> | ||
<div | ||
class={`absolute bottom-0 right-11 bg-white rounded-md p-4 duration-200 ${isOpen ? 'opacity-100' : 'opacity-0 pointer-events-none'} overflow-hidden flex flex-col gap-2`} | ||
> | ||
<p class="font-semibold leading-0 text-lg mb-3">Legend</p> | ||
{#each taskStatuses as taskStatus} | ||
<div class="flex items-center gap-2"> | ||
{#if !taskStatus.color} | ||
<div class="w-5 h-5 flex justify-center"> | ||
<img src={taskStatus.icon} class="w-4" alt="Lock Icon" /> | ||
</div> | ||
{:else} | ||
<div | ||
style="background-color: {taskStatus.color}; border: 1px solid #D0D0D0;" | ||
class={`w-5 h-5 opacity-40`} | ||
></div> | ||
{/if} | ||
<p class="font-regular text-[#494949] text-nowrap leading-0">{taskStatus?.status}</p> | ||
</div> | ||
{/each} | ||
</div> | ||
<div class={`${isOpen ? 'flex' : 'hidden'} flex-col gap-2`}> | ||
<p class="font-semibold leading-0 text-lg mb-3">Legend (Features)</p> | ||
{#each taskStatuses as taskStatus} | ||
<div class="flex items-center gap-2"> | ||
<div | ||
style="background-color: {taskStatus.color};" | ||
class="w-5 h-5 opacity-40 border-solid border-[1px] border-[#D0D0D0]" | ||
></div> | ||
<p class="font-regular text-[#494949] text-nowrap leading-0">{taskStatus?.status}</p> | ||
</div> | ||
{/each} | ||
</div> | ||
|
||
<style></style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters