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

This commit is contained in:
Andrew Kingston 2022-05-19 21:03:20 +01:00
parent b281e233b3
commit c2a40dc88e
1 changed files with 10 additions and 3 deletions

View File

@ -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