Skip to content

Commit

Permalink
Fix/2603 sidebar border (#2606)
Browse files Browse the repository at this point in the history
* feat: add new option 'border' to enable customising border style (color, width, etc) for sidebar

* fix: set sidebar border to none
  • Loading branch information
JinIgarashi authored Jan 2, 2024
1 parent 931d4f2 commit 0a8a202
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/metal-dodos-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"geohub": patch
---

fix: set sidebar border to none
5 changes: 5 additions & 0 deletions .changeset/tricky-hotels-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@undp-data/svelte-sidebar": minor
---

feat: add new option 'border' to enable customising border style (color, width, etc) for sidebar
17 changes: 7 additions & 10 deletions packages/svelte-sidebar/src/lib/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
*/
export let height: number = undefined;
/**
* Default sidebar border style
*/
export let border = '1px solid #1c1c1c';
let innerWidth: number;
let innerHeight: number;
$: isMobile = innerWidth < 768 ? true : false;
Expand All @@ -52,7 +57,7 @@
{#if show}
<div
class="sidebar-content left"
style="min-width: {defaultMinSidebarWidth};max-width: {defaultMinSidebarWidth};"
style="min-width: {defaultMinSidebarWidth};max-width: {defaultMinSidebarWidth}; border-right: {border};"
transition:slide={{ axis: 'x' }}
data-testid="sidebar-content"
>
Expand Down Expand Up @@ -143,7 +148,7 @@
{#if show}
<div
class="sidebar-content right"
style="min-width: {defaultMinSidebarWidth};max-width: {defaultMinSidebarWidth};"
style="min-width: {defaultMinSidebarWidth};max-width: {defaultMinSidebarWidth}; border-left: {border};"
transition:slide={{ axis: 'x' }}
data-testid="sidebar-content"
>
Expand All @@ -157,14 +162,6 @@
.sidebar-content {
position: relative;
height: 100%;
&.left {
border-right: 1px solid #1c1c1c;
}
&.right {
border-left: 1px solid #1c1c1c;
}
}
.main-content {
Expand Down
15 changes: 14 additions & 1 deletion packages/svelte-sidebar/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Sidebar, type SidebarPosition } from '$lib';
let sidebarPosition: SidebarPosition = 'left';
let sidebarBorderStyle = '1px solid #1c1c1c';
</script>

<svelte:head>
Expand All @@ -15,7 +16,7 @@
/>
</svelte:head>

<Sidebar show={true} bind:position={sidebarPosition}>
<Sidebar show={true} bind:position={sidebarPosition} bind:border={sidebarBorderStyle}>
<div slot="content" class="p-4">
Sidebar content

Expand All @@ -33,6 +34,18 @@
}}>Right</button
>
</div>

<div class="field">
<label class="label" for="border-style-input">Border style</label>
<div class="control" id="border-style-input">
<input
class="input"
type="text"
placeholder="Sidebar border style"
bind:value={sidebarBorderStyle}
/>
</div>
</div>
</div>
<div slot="main">
<h1>Welcome to your library project</h1>
Expand Down
2 changes: 2 additions & 0 deletions sites/geohub/src/routes/(map)/maps/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@
bind:show={isMenuShown}
bind:position={sideBarPosition}
bind:marginTop={$headerHeightStore}
border="none"
>
<div slot="content">
<Content bind:splitterHeight={splitHeight} />
Expand All @@ -185,6 +186,7 @@
bind:showToggleButton={$editingMenuShownStore}
position={sideBarPosition === 'left' ? 'right' : 'left'}
bind:height={splitHeight}
border="none"
>
<div slot="content">
<LayerEdit />
Expand Down

0 comments on commit 0a8a202

Please sign in to comment.