Browse Source

Allow indicator to be shown for hovering and selecting navigation section, including title and icon

pull/6409/head
Andrew Kingston 4 years ago
parent
commit
c2a40dc88e
  1. 13
      packages/client/src/components/preview/IndicatorSet.svelte

13
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

Loading…
Cancel
Save