Highlighted child components of selected component
This commit is contained in:
parent
08a98b4b95
commit
ea38e5661e
|
@ -15,6 +15,7 @@
|
|||
export let iconColor
|
||||
export let scrollable = false
|
||||
export let color
|
||||
export let highlighted = false
|
||||
|
||||
const scrollApi = getContext("scroll")
|
||||
const dispatch = createEventDispatcher()
|
||||
|
@ -46,6 +47,8 @@
|
|||
class:border
|
||||
class:selected
|
||||
class:withActions
|
||||
class:scrollable
|
||||
class:highlighted
|
||||
style={`padding-left: calc(${indentLevel * 14}px)`}
|
||||
{draggable}
|
||||
on:dragend
|
||||
|
@ -55,7 +58,6 @@
|
|||
on:click={onClick}
|
||||
ondragover="return false"
|
||||
ondragenter="return false"
|
||||
class:scrollable
|
||||
>
|
||||
<div class="nav-item-content" bind:this={contentRef}>
|
||||
{#if withArrow}
|
||||
|
@ -112,12 +114,15 @@
|
|||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
.nav-item.highlighted {
|
||||
background-color: var(--spectrum-global-color-gray-200);
|
||||
}
|
||||
.nav-item.selected {
|
||||
background-color: var(--grey-2);
|
||||
background-color: var(--spectrum-global-color-gray-300);
|
||||
color: var(--ink);
|
||||
}
|
||||
.nav-item:hover {
|
||||
background-color: var(--grey-3);
|
||||
background-color: var(--spectrum-global-color-gray-300);
|
||||
}
|
||||
.nav-item:hover .actions {
|
||||
visibility: visible;
|
||||
|
|
|
@ -5,7 +5,13 @@
|
|||
import NavItem from "components/common/NavItem.svelte"
|
||||
import { capitalise } from "helpers"
|
||||
import { notifications } from "@budibase/bbui"
|
||||
import { selectedComponentPath } from "builderStore"
|
||||
import {
|
||||
selectedComponentPath,
|
||||
selectedComponent,
|
||||
selectedScreen,
|
||||
} from "builderStore"
|
||||
import { findComponentPath } from "builderStore/componentUtils"
|
||||
import { get } from "svelte/store"
|
||||
|
||||
export let components = []
|
||||
export let currentComponent
|
||||
|
@ -87,6 +93,15 @@
|
|||
}
|
||||
return !closedNodes[component._id]
|
||||
}
|
||||
|
||||
const isChildOfSelectedComponent = component => {
|
||||
const selectedComponentId = get(selectedComponent)?._id
|
||||
const selectedScreenId = get(selectedScreen)?.props._id
|
||||
if (!selectedComponentId || selectedComponentId === selectedScreenId) {
|
||||
return false
|
||||
}
|
||||
return findComponentPath($selectedComponent, component._id)?.length > 0
|
||||
}
|
||||
</script>
|
||||
|
||||
<ul>
|
||||
|
@ -120,6 +135,7 @@
|
|||
indentLevel={level + 1}
|
||||
selected={$store.selectedComponentId === component._id}
|
||||
opened={isOpen(component, $selectedComponentPath, closedNodes)}
|
||||
highlighted={isChildOfSelectedComponent(component)}
|
||||
>
|
||||
<ComponentDropdownMenu {component} />
|
||||
</NavItem>
|
||||
|
|
Loading…
Reference in New Issue