Skip to content

Commit

Permalink
fix: adjust desigin of layer header and tabs (#2245)
Browse files Browse the repository at this point in the history
  • Loading branch information
JinIgarashi authored Nov 10, 2023
1 parent ce51272 commit 8308f62
Show file tree
Hide file tree
Showing 13 changed files with 69 additions and 66 deletions.
5 changes: 5 additions & 0 deletions .changeset/lovely-flies-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@undp-data/undp-bulma": patch
---

fix: fixed customised tab design for bulma. Removed border-radius from boxed/toggled tab.
5 changes: 5 additions & 0 deletions .changeset/ninety-llamas-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"geohub": patch
---

fix: adjust desigin of layer header and tabs
6 changes: 4 additions & 2 deletions packages/undp-bulma/bulma.scss
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ $family-primary: $family-serif;
// customised tab color for UNDP
$tabs-link-active-color: $primary;
$tabs-link-active-border-bottom-color: $primary;
$tabs-boxed-link-active-border-color: $primary;
$tabs-boxed-link-active-border-bottom-color: $primary;
$tabs-toggle-link-active-background-color: $primary;
$tabs-toggle-link-active-border-color: $primary;
$tabs-toggle-link-active-color: white;
// roundness for tab
$tabs-boxed-link-radius: 0;
$tabs-toggle-link-radius: 0;
$tabs-boxed-link-radius: 0;

// 4. Setup your Custom Colors
$linkedin: #0077b5;
Expand Down
78 changes: 36 additions & 42 deletions sites/geohub/src/components/maplibre/LegendTypeSwitcher.svelte
Original file line number Diff line number Diff line change
@@ -1,46 +1,40 @@
<script lang="ts">
export let legendType: 'default' | 'classify' = 'default';
const handleLegendTypeChange = () => {
legendType = legendType === 'default' ? 'classify' : 'default';
};
import { handleEnterKey } from '$lib/helper';
let tabs: { label: 'default' | 'classify'; icon: string }[] = [
{
label: 'default',
icon: 'fa-solid fa-minus'
},
{
label: 'classify',
icon: 'fa-solid fa-list'
}
];
export let legendType: 'default' | 'classify' = tabs[0].label;
</script>

<div class="centered pb-2" data-testid="legend-type-switcher-container">
<div class="field has-addons">
<p class="control">
<button
data-testid="legend-type-switcher-default"
class="button is-normal {`${
legendType === 'default' ? 'is-primary is-active' : 'is-primary is-light'
}`}"
on:click={handleLegendTypeChange}
>
<span>
<i class="fa-solid fa-minus" />
Default
</span>
</button>
</p>
<p class="control">
<button
data-testid="legend-type-switcher-classify"
class="button is-normal {`${
legendType === 'classify' ? 'is-primary is-active' : 'is-primary is-light'
}`}"
on:click={handleLegendTypeChange}
>
<span>
<i class="fa-solid fa-list" />
Classify
</span>
</button>
</p>
</div>
<div class="tabs is-centered is-toggle">
<ul>
{#each tabs as tab}
<li class={legendType === tab.label ? 'is-active' : ''}>
<!-- svelte-ignore a11y-missing-attribute -->
<a
class="has-text-weight-bold"
role="tab"
tabindex="0"
data-sveltekit-preload-code="off"
data-sveltekit-preload-data="off"
on:click={() => {
legendType = tab.label;
}}
on:keydown={handleEnterKey}
>
<span class="icon is-small"><i class={tab.icon} aria-hidden="true"></i></span>
<span class="is-capitalized">{tab.label}</span>
</a>
</li>
{/each}
</ul>
</div>

<style lang="scss">
:global(.centered) {
width: max-content;
margin: auto !important;
}
</style>
4 changes: 2 additions & 2 deletions sites/geohub/src/components/maplibre/line/VectorLine.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
let activeTab: string = tabs[0].label;
</script>

<div class="tabs is-centered">
<div class="tabs is-centered is-toggle">
<ul>
{#each tabs as tab}
<li class={activeTab === tab.label ? 'is-active' : ''}>
<!-- svelte-ignore a11y-missing-attribute -->
<a
class="has-text-weight-bold"
class="has-text-weight-bold tab"
role="tab"
tabindex="0"
data-sveltekit-preload-code="off"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
};
</script>

<div class="tabs is-centered">
<div class="tabs is-centered is-toggle">
<ul>
{#each tabs as tab}
<li class={activeTab === tab.label ? 'is-active' : ''}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
.editor-button {
position: absolute;
top: -0.8em;
top: 0em;
right: 0em;
z-index: 10;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
>
<span class="delete-all-icon icon fa-stack fa-lg" role="button" tabindex="0">
<i class="fa-solid fa-layer-group fa-lg" />
<i class="fa-solid fa-circle-xmark fa-sm fa-stack-1x" />
<i class="fa-solid fa-circle-xmark fa-xs fa-stack-1x" />
</span>
</button>

Expand Down Expand Up @@ -145,6 +145,7 @@
.fa-circle-xmark {
margin-left: 8px;
margin-top: 15px;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@
};
</script>

<article class="border is-small mb-2">
<div
class="message-header has-background-white has-text-dark {isContentVisible ? 'underline' : ''}"
>
<article class="border is-small">
<div class="message-header has-background-white has-text-dark pr-0">
<LayerHeader {layer} bind:isVisible={isContentVisible} />

<div class="is-flex is-align-items-center">
Expand All @@ -89,7 +87,7 @@
</div>
</div>
<div
class="message-body has-background-white has-text-dark pt-2 px-0 pb-4"
class="message-body has-background-white has-text-dark px-0 pb-2 pt-0"
hidden={!isContentVisible}
>
<slot />
Expand Down Expand Up @@ -145,13 +143,13 @@

<style lang="scss">
.border {
border: 1px #7a7a7a solid;
}
.underline {
border-bottom: 1px #7a7a7a solid;
}
// .underline {
// border-bottom: 1px #7a7a7a solid;
// }
.toggle-button,
.menu-button {
border: none;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
isVisible = !isVisible;
}}
>
<div class="toggle-button icon has-text-primary mr-2">
<i class="fa-solid fa-chevron-{isVisible ? 'up' : 'down'} fa-2xl"></i>
<div class="toggle-button icon has-text-primary mr-3">
<i class="fa-solid fa-chevron-{isVisible ? 'up' : 'down'} fa-xl"></i>
</div>

{#if accessIcon}
<i class="{accessIcon} fa-2xl px-2" />
{/if}

<span class="layer-name is-size-6 mr-1">
<span class="layer-name is-size-6 mr-2">
{clean(layer.name)}
</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
on:click={() => toggleVisibility()}
on:keydown={handleKeyDown}
>
<i class="fa-solid {visibility === 'visible' ? 'fa-eye' : 'fa-eye-slash'} fa-xl" />
<i class="fa-solid {visibility === 'visible' ? 'fa-eye' : 'fa-eye-slash'} fa-lg" />
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,14 @@
</script>

<LayerTemplate {layer}>
<div class="tabs is-fullwidth">
<div class="tabs is-centered is-boxed px-3 mb-4">
<ul>
{#each tabs as tab}
<li class={activeTab === tab.label ? 'is-active' : ''}>
<!-- svelte-ignore a11y-missing-attribute -->
<a
role="tab"
tabindex="0"
class="px-1 py-1"
on:click={() => (activeTab = tab.label)}
on:keydown={handleEnterKey}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,14 @@
<Loader size="small" />
</div>
{:then}
<div class="tabs is-fullwidth">
<div class="tabs is-centered is-boxed px-3 mb-4">
<ul>
{#each tabs as tab}
<li class={activeTab === tab.label ? 'is-active' : ''}>
<!-- svelte-ignore a11y-missing-attribute -->
<a
role="tab"
tabindex="0"
class="px-1 py-1"
on:click={() => (activeTab = tab.label)}
on:keydown={handleEnterKey}
>
Expand Down

0 comments on commit 8308f62

Please sign in to comment.