Move components to above app preview
This commit is contained in:
parent
79cca1956a
commit
1fac774521
|
@ -9,15 +9,22 @@
|
||||||
import Tab from "./ItemTab/Tab.svelte"
|
import Tab from "./ItemTab/Tab.svelte"
|
||||||
|
|
||||||
const categories = components.categories
|
const categories = components.categories
|
||||||
let selectedIndex
|
let selectedCategory
|
||||||
let width
|
let width
|
||||||
$: selectedCategory = selectedIndex == null ? null : categories[selectedIndex]
|
|
||||||
|
|
||||||
const close = () => {
|
const close = () => {
|
||||||
selectedIndex = null
|
selectedCategory = null
|
||||||
}
|
}
|
||||||
|
|
||||||
const onComponentChosen = component => {
|
const onCategoryChosen = (category) => {
|
||||||
|
if (category.isCategory) {
|
||||||
|
selectedCategory = selectedCategory === category ? null : category
|
||||||
|
} else {
|
||||||
|
onComponentChosen(category)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const onComponentChosen = (component) => {
|
||||||
store.addChildComponent(component._component, component.presetProps)
|
store.addChildComponent(component._component, component.presetProps)
|
||||||
|
|
||||||
// Get ID path
|
// Get ID path
|
||||||
|
@ -33,14 +40,15 @@
|
||||||
<div
|
<div
|
||||||
class="container"
|
class="container"
|
||||||
bind:clientWidth={width}
|
bind:clientWidth={width}
|
||||||
class:border={selectedCategory == null}>
|
class:open={selectedCategory != null}>
|
||||||
{#each categories as category, idx}
|
{#each categories as category, idx}
|
||||||
<div
|
<div
|
||||||
class="category"
|
class="category"
|
||||||
on:click={() => (selectedIndex = idx)}
|
on:click={() => onCategoryChosen(category)}
|
||||||
class:active={selectedCategory === category}>
|
class:active={selectedCategory === category}>
|
||||||
{category.name}
|
{#if category.icon}<i class={category.icon} />{/if}
|
||||||
<i class="ri-arrow-down-s-line" />
|
<span>{category.name}</span>
|
||||||
|
{#if category.isCategory}<i class="ri-arrow-down-s-line arrow" />{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
@ -49,7 +57,7 @@
|
||||||
<div class="dropdown" transition:fly={{ y: -120 }}>
|
<div class="dropdown" transition:fly={{ y: -120 }}>
|
||||||
<Tab
|
<Tab
|
||||||
list={selectedCategory}
|
list={selectedCategory}
|
||||||
on:selectItem={e => onComponentChosen(e.detail)} />
|
on:selectItem={(e) => onComponentChosen(e.detail)} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -61,33 +69,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
padding: var(--spacing-xl) 40px;
|
padding: var(--spacing-l) 40px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
width: calc(100% - 80px);
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
.container.border {
|
.container.open {
|
||||||
border-bottom: 1px solid var(--grey-2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.category {
|
.category {
|
||||||
color: var(--ink);
|
color: var(--grey-7);
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
margin-right: var(--spacing-xl);
|
margin-right: var(--spacing-l);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: var(--spacing-xs);
|
gap: var(--spacing-xs);
|
||||||
font-size: var(--font-size-s);
|
font-size: var(--font-size-xs);
|
||||||
|
}
|
||||||
|
.category span {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
.category.active,
|
.category.active,
|
||||||
.category:hover {
|
.category:hover {
|
||||||
color: var(--blue);
|
color: var(--ink);
|
||||||
|
}
|
||||||
|
.category i:not(:last-child) {
|
||||||
|
font-size: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.overlay {
|
.overlay {
|
||||||
|
@ -107,7 +122,6 @@
|
||||||
width: calc(100% - 80px);
|
width: calc(100% - 80px);
|
||||||
background-color: white;
|
background-color: white;
|
||||||
padding: var(--spacing-xl) 40px;
|
padding: var(--spacing-xl) 40px;
|
||||||
border-bottom: 1px solid var(--grey-2);
|
|
||||||
box-shadow: 0 0 8px 4px rgba(0, 0, 0, 0.05);
|
box-shadow: 0 0 8px 4px rgba(0, 0, 0, 0.05);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -32,19 +32,18 @@
|
||||||
settingsView.show()
|
settingsView.show()
|
||||||
}
|
}
|
||||||
|
|
||||||
const lastPartOfName = c => (c ? last(c.split("/")) : "")
|
const lastPartOfName = (c) => (c ? last(c.split("/")) : "")
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- routify:options index=1 -->
|
<!-- routify:options index=1 -->
|
||||||
<div class="root">
|
<div class="root">
|
||||||
|
|
||||||
<div class="ui-nav">
|
<div class="ui-nav">
|
||||||
<FrontendNavigatePane />
|
<FrontendNavigatePane />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="preview-pane">
|
<div class="preview-pane">
|
||||||
{#if $store.currentPageName && $store.currentPageName.length > 0}
|
{#if $store.currentPageName && $store.currentPageName.length > 0}
|
||||||
<ComponentSelectionList/>
|
<ComponentSelectionList />
|
||||||
<div class="preview-content">
|
<div class="preview-content">
|
||||||
<CurrentItemPreview />
|
<CurrentItemPreview />
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,7 +55,6 @@
|
||||||
<ComponentPropertiesPanel />
|
<ComponentPropertiesPanel />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
|
@ -64,8 +62,8 @@
|
||||||
<style>
|
<style>
|
||||||
.root {
|
.root {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 300px 1fr 300px;
|
grid-template-columns: 260px 1fr 260px;
|
||||||
background: var(--grey-1);
|
background: var(--grey-2);
|
||||||
align-items: stretch;
|
align-items: stretch;
|
||||||
height: calc(100vh - 60px);
|
height: calc(100vh - 60px);
|
||||||
}
|
}
|
||||||
|
@ -101,6 +99,13 @@
|
||||||
grid-column: 3;
|
grid-column: 3;
|
||||||
background-color: var(--white);
|
background-color: var(--white);
|
||||||
border-left: 1px solid var(--grey-2);
|
border-left: 1px solid var(--grey-2);
|
||||||
|
overflow-y: auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: stretch;
|
||||||
|
gap: var(--spacing-l);
|
||||||
|
padding: var(--spacing-xl);
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-group-header > div:nth-child(1) {
|
.nav-group-header > div:nth-child(1) {
|
||||||
|
|
Loading…
Reference in New Issue