From c2a40dc88e653d580e0fde7c42e9af30d3c3746e Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 19 May 2022 21:03:20 +0100 Subject: [PATCH] Allow indicator to be shown for hovering and selecting navigation section, including title and icon --- .../src/components/preview/IndicatorSet.svelte | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/preview/IndicatorSet.svelte b/packages/client/src/components/preview/IndicatorSet.svelte index a6ca57aef0..c33ea606ff 100644 --- a/packages/client/src/components/preview/IndicatorSet.svelte +++ b/packages/client/src/components/preview/IndicatorSet.svelte @@ -13,9 +13,11 @@ let indicators = [] let interval let text + let icon + $: visibleIndicators = indicators.filter(x => x.visible) $: offset = $builderStore.inBuilder ? 0 : 2 - $: icon = getComponentIcon(componentId) + $: getComponentIcon(componentId) let updating = false let observers = [] @@ -24,12 +26,14 @@ const getComponentIcon = id => { if (!id) { - return null + return } const component = componentStore.actions.getComponentById(id) const type = component?._component const definition = componentStore.actions.getComponentDefinition(type) - return definition?.icon + if (definition?.icon) { + icon = definition.icon + } } const createIntersectionCallback = idx => entries => { @@ -68,6 +72,9 @@ if (prefix) { text = `${prefix} ${text}` } + if (parents[0].dataset.icon) { + icon = parents[0].dataset.icon + } } // Batch reads to minimize reflow