diff --git a/.changeset/popover-layercontrols.md b/.changeset/popover-layercontrols.md new file mode 100644 index 000000000..5b49dcc0f --- /dev/null +++ b/.changeset/popover-layercontrols.md @@ -0,0 +1,5 @@ +--- +'@ldn-viz/ui': minor +--- + +CHANGED: use `Popover` component in `ColorPicker`/`OpacityControl`/`ResizeControl`, rather than duplicating implementation diff --git a/packages/ui/src/lib/layerControl/ColorPicker.svelte b/packages/ui/src/lib/layerControl/ColorPicker.svelte index 4a8ddac1d..125d6d072 100644 --- a/packages/ui/src/lib/layerControl/ColorPicker.svelte +++ b/packages/ui/src/lib/layerControl/ColorPicker.svelte @@ -1,17 +1,5 @@ - -
-
-
-
-
-{#if $open} -
-
- -
-

Color

- Click to assign a color to this layer. + let openStore; + -
- {#each colors as colorOption} - - {/each} -
+ + +
+
- - +
+ + Color + + Click to assign a color to this layer. + +
+ {#each colors as colorOption} +
-{/if} - - +
diff --git a/packages/ui/src/lib/layerControl/OpacityControl.svelte b/packages/ui/src/lib/layerControl/OpacityControl.svelte index d134fcfb7..fc61fab9f 100644 --- a/packages/ui/src/lib/layerControl/OpacityControl.svelte +++ b/packages/ui/src/lib/layerControl/OpacityControl.svelte @@ -1,59 +1,23 @@ -
-
- -{#if $open} -
-
+ + + -
-

Opacity

+ Opacity -
-
- -
-
-
+
+
+
- - +
-{/if} - - + diff --git a/packages/ui/src/lib/layerControl/ResizeControl.svelte b/packages/ui/src/lib/layerControl/ResizeControl.svelte index 83cdb5f60..c7022ac1d 100644 --- a/packages/ui/src/lib/layerControl/ResizeControl.svelte +++ b/packages/ui/src/lib/layerControl/ResizeControl.svelte @@ -1,18 +1,6 @@ -
-
- -{#if $open} -
-
+ + + -
-

Marker size

+ Marker size -
-
- -
-
+
+
+
- -
-{/if} - - + diff --git a/packages/ui/src/lib/popover/Popover.svelte b/packages/ui/src/lib/popover/Popover.svelte index df482a8fc..488c84abd 100644 --- a/packages/ui/src/lib/popover/Popover.svelte +++ b/packages/ui/src/lib/popover/Popover.svelte @@ -34,6 +34,12 @@ * text size for the tooltip target */ export let hintSize: 'sm' | 'md' | 'lg' | undefined = undefined; + + /** + * Store controlling whether popover is open. + */ + export let openStore; + $: openStore = open;