From f4bbca30cad6e1906b176547de7ad7cb57c4b6a1 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 21 Oct 2020 09:19:26 +0100 Subject: [PATCH] Add initial work on dropdown components --- packages/builder/src/budibase.css | 8 -- .../ComponentSelectionList.svelte | 107 ++++++++++++++---- .../userInterface/FrontendNavigatePane.svelte | 8 +- .../userInterface/ItemTab/Item.svelte | 4 +- .../userInterface/ItemTab/Tab.svelte | 22 +++- .../[application]/frontend/_layout.svelte | 44 +++---- 6 files changed, 129 insertions(+), 64 deletions(-) diff --git a/packages/builder/src/budibase.css b/packages/builder/src/budibase.css index 6dc786f522..1426a7beed 100644 --- a/packages/builder/src/budibase.css +++ b/packages/builder/src/budibase.css @@ -85,14 +85,6 @@ box-sizing: border-box; } -.preview-pane { - grid-column: 2; - margin: 80px 60px; - background: #fff; - border-radius: 5px; - box-shadow: 0 0px 6px rgba(0, 0, 0, 0.05); -} - .budibase__table { border: 1px solid var(--grey-4); background: #fff; diff --git a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte index 00ce42cf61..404cfa102b 100644 --- a/packages/builder/src/components/userInterface/ComponentSelectionList.svelte +++ b/packages/builder/src/components/userInterface/ComponentSelectionList.svelte @@ -3,46 +3,111 @@ import { store } from "builderStore" import components from "./temporaryPanelStructure.js" import CategoryTab from "./CategoryTab.svelte" + import { Popover } from "@budibase/bbui" + import { fade, fly } from "svelte/transition" import Tab from "./ItemTab/Tab.svelte" - export let toggleTab - const categories = components.categories - let selectedCategory = categories[0] + let selectedIndex + let width + $: selectedCategory = selectedIndex == null ? null : categories[selectedIndex] + + const close = () => { + selectedIndex = null + } const onComponentChosen = component => { store.addChildComponent(component._component, component.presetProps) - toggleTab("Navigate") - // Get ID path const path = store.getPathToComponent($store.currentComponentInfo) // Go to correct URL $goto(`./:page/:screen/${path}`) + close() } -
- (selectedCategory = category)} - {selectedCategory} - {categories} /> - -
- onComponentChosen(e.detail)} - {toggleTab} /> +
+
+ {#each categories as category, idx} +
(selectedIndex = idx)} + class:active={selectedCategory === category}> + {category.name} + +
+ {/each}
+ {#if selectedCategory != null} +
+ + {/if}
diff --git a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte index 64c3ee45f4..651cc5c6ac 100644 --- a/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte +++ b/packages/builder/src/components/userInterface/FrontendNavigatePane.svelte @@ -4,19 +4,17 @@ import PageLayout from "components/userInterface/PageLayout.svelte" import PagesList from "components/userInterface/PagesList.svelte" import NewScreenModal from "components/userInterface/NewScreenModal.svelte" - import { Button, Spacer, Modal } from "@budibase/bbui" + import { Button, Spacer, Modal, Heading } from "@budibase/bbui" let modal +Screens - - - - diff --git a/packages/builder/src/components/userInterface/ItemTab/Item.svelte b/packages/builder/src/components/userInterface/ItemTab/Item.svelte index 7d118afe61..de04bc5208 100644 --- a/packages/builder/src/components/userInterface/ItemTab/Item.svelte +++ b/packages/builder/src/components/userInterface/ItemTab/Item.svelte @@ -14,12 +14,12 @@ display: flex; flex-direction: column; cursor: pointer; - padding: 12px 16px 16px 16px; - height: 80px; justify-content: center; align-items: center; background-color: var(--grey-1); border-radius: 5px; + width: 120px; + height: 80px; } .item-item:hover { diff --git a/packages/builder/src/components/userInterface/ItemTab/Tab.svelte b/packages/builder/src/components/userInterface/ItemTab/Tab.svelte index 090fad1dc1..db16acf3d6 100644 --- a/packages/builder/src/components/userInterface/ItemTab/Tab.svelte +++ b/packages/builder/src/components/userInterface/ItemTab/Tab.svelte @@ -25,11 +25,13 @@ {#if !list.isCategory} {/if} -{#each list.children as item} - {#if !item.showOnPages || item.showOnPages.includes($store.currentPageName)} - handleClick(item)} /> - {/if} -{/each} +
+ {#each list.children as item} + {#if !item.showOnPages || item.showOnPages.includes($store.currentPageName)} + handleClick(item)} /> + {/if} + {/each} +
diff --git a/packages/builder/src/pages/[application]/frontend/_layout.svelte b/packages/builder/src/pages/[application]/frontend/_layout.svelte index 0aae313ccd..420a1bd2ea 100644 --- a/packages/builder/src/pages/[application]/frontend/_layout.svelte +++ b/packages/builder/src/pages/[application]/frontend/_layout.svelte @@ -32,8 +32,6 @@ settingsView.show() } - let leftNavSwitcher - const lastPartOfName = c => (c ? last(c.split("/")) : "") @@ -41,21 +39,15 @@
- - -
- -
-
- -
-
- +
{#if $store.currentPageName && $store.currentPageName.length > 0} - + +
+ +
{/if}
@@ -73,34 +65,42 @@ .root { display: grid; grid-template-columns: 300px 1fr 300px; - width: 100%; background: var(--grey-1); - flex: 1; - min-height: 0; align-items: stretch; + height: calc(100vh - 60px); } .ui-nav { grid-column: 1; background-color: var(--white); - height: calc(100vh - 69px); - padding: 0; display: flex; flex-direction: column; + gap: var(--spacing-m); + padding: var(--spacing-xl); + overflow-y: auto; + border-right: 1px solid var(--grey-2); } .preview-pane { grid-column: 2; - margin: 40px; + overflow-y: auto; + display: flex; + flex-direction: column; + justify-content: flex-start; + align-items: stretch; + gap: var(--spacing-m); + } + .preview-content { background: #fff; - border-radius: 5px; + box-shadow: 0 0 12px rgba(0, 0, 0, 0.05); + flex: 1 1 auto; + margin: var(--spacing-xl) 40px; } .components-pane { grid-column: 3; background-color: var(--white); - min-height: 0px; - height: calc(100vh - 69px); + border-left: 1px solid var(--grey-2); } .nav-group-header > div:nth-child(1) {