From a4d808c7f243160ce1e04b8246a0b3c029428c3b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 17 Jun 2021 12:57:36 +0100 Subject: [PATCH] Update server generated layouts and improve layout styles --- .../NavigationEditor/NavigationDrawer.svelte | 8 +- packages/server/src/constants/layouts.js | 126 ++++-------------- packages/standard-components/manifest.json | 6 + .../standard-components/src/Layout.svelte | 46 +++---- .../standard-components/src/ScreenSlot.svelte | 17 ++- 5 files changed, 70 insertions(+), 133 deletions(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte index d1cd355fa3..9e33c627d9 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/NavigationEditor/NavigationDrawer.svelte @@ -16,12 +16,18 @@ const flipDurationMs = 150 + $: links.forEach(link => { + if (!link.id) { + link.id = generate() + } + }) + $: urlOptions = $store.screens .map(screen => screen.routing?.route) .filter(x => x != null) const addLink = () => { - links = [...links, { id: generate() }] + links = [...links, {}] } const removeLink = id => { diff --git a/packages/server/src/constants/layouts.js b/packages/server/src/constants/layouts.js index c8e71252ef..cc61ea6e86 100644 --- a/packages/server/src/constants/layouts.js +++ b/packages/server/src/constants/layouts.js @@ -22,9 +22,7 @@ const EMPTY_LAYOUT = { "flex-direction": "column", "justify-content": "flex-start", "align-items": "stretch", - "max-width": "100%", - width: "1400px", - padding: "20px", + padding: "32px", }, hover: {}, active: {}, @@ -37,15 +35,17 @@ const EMPTY_LAYOUT = { active: {}, hover: {}, normal: { - "min-height": "100%", "background-image": "#f5f5f5", }, selected: {}, }, - direction: "column", - hAlign: "center", - vAlign: "top", - size: "grow", + navigation: "Top", + links: [ + { + text: "Home", + url: "/", + }, + ], }, } @@ -56,83 +56,11 @@ const BASE_LAYOUTS = [ title: "{{ name }}", favicon: "./_shared/favicon.png", stylesheets: [], - name: "Top Navigation Layout", + name: "Navigation Layout", props: { _id: "4f569166-a4f3-47ea-a09e-6d218c75586f", - _component: "@budibase/standard-components/container", + _component: "@budibase/standard-components/layout", _children: [ - { - _id: "c74f07266980c4b6eafc33e2a6caa783d", - _component: "@budibase/standard-components/container", - _styles: { - normal: { - background: "#fff", - width: "100%", - "box-shadow": "0 1px 2px 0 rgba(0, 0, 0, 0.05)", - }, - hover: {}, - active: {}, - selected: {}, - }, - _instanceName: "Header", - _children: [ - { - _id: "49e0e519-9e5e-4127-885a-ee6a0a49e2c1", - _component: "@budibase/standard-components/navigation", - _styles: { - normal: { - "max-width": "1400px", - padding: "20px", - "font-weight": "400", - "font-size": "16px", - flex: "1 1 auto", - }, - hover: {}, - active: {}, - selected: {}, - }, - title: "", - backgroundColor: "", - color: "", - borderWidth: "", - borderColor: "", - borderStyle: "", - _instanceName: "Navigation", - _children: [ - { - _id: "48b35328-4c91-4343-a6a3-1a1fd77b3386", - _component: "@budibase/standard-components/link", - _styles: { - normal: { - "font-weight": "600", - "text-decoration-line": "none", - "font-size": "16px", - }, - hover: { - color: "#4285f4", - }, - active: {}, - selected: {}, - }, - url: "/", - openInNewTab: false, - text: "Home", - color: "", - hoverColor: "", - underline: false, - fontSize: "", - fontFamily: "initial", - _instanceName: "Home Link", - _children: [], - }, - ], - }, - ], - direction: "row", - hAlign: "center", - vAlign: "middle", - size: "shrink", - }, { _id: "7fcf11e4-6f5b-4085-8e0d-9f3d44c98967", _component: "@budibase/standard-components/screenslot", @@ -143,9 +71,7 @@ const BASE_LAYOUTS = [ "flex-direction": "column", "justify-content": "flex-start", "align-items": "stretch", - "max-width": "100%", - width: "1400px", - padding: "20px", + padding: "32px", }, hover: {}, active: {}, @@ -158,15 +84,17 @@ const BASE_LAYOUTS = [ active: {}, hover: {}, normal: { - "min-height": "100%", background: "#f5f5f5", }, selected: {}, }, - direction: "column", - hAlign: "center", - vAlign: "top", - size: "grow", + navigation: "Top", + links: [ + { + text: "Home", + url: "/", + }, + ], }, }, { @@ -178,7 +106,7 @@ const BASE_LAYOUTS = [ name: "Empty Layout", props: { _id: "3723ffa1-f9e0-4c05-8013-98195c788ed6", - _component: "@budibase/standard-components/container", + _component: "@budibase/standard-components/layout", _children: [ { _id: "7fcf11e4-6f5b-4085-8e0d-9f3d44c98967", @@ -190,9 +118,7 @@ const BASE_LAYOUTS = [ "flex-direction": "column", "justify-content": "flex-start", "align-items": "stretch", - "max-width": "100%", - width: "1400px", - padding: "20px", + padding: "32px", }, hover: {}, active: {}, @@ -205,15 +131,17 @@ const BASE_LAYOUTS = [ active: {}, hover: {}, normal: { - "min-height": "100%", background: "#f5f5f5", }, selected: {}, }, - direction: "column", - hAlign: "center", - vAlign: "top", - size: "grow", + navigation: "Top", + links: [ + { + text: "Home", + url: "/", + }, + ], }, }, ] diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json index 45cfc0eb04..5fff49f388 100644 --- a/packages/standard-components/manifest.json +++ b/packages/standard-components/manifest.json @@ -37,6 +37,12 @@ "options": ["Top", "Left", "None"], "defaultValue": "Top" }, + { + "type": "boolean", + "label": "Sticky header", + "key": "sticky", + "defaultValue": false + }, { "type": "navigation", "label": "Links", diff --git a/packages/standard-components/src/Layout.svelte b/packages/standard-components/src/Layout.svelte index db0a7ce168..72efe906a2 100644 --- a/packages/standard-components/src/Layout.svelte +++ b/packages/standard-components/src/Layout.svelte @@ -1,16 +1,16 @@ -
+

Screen Slot

The screens that you create will be displayed inside this box. @@ -20,13 +20,16 @@ div { display: flex !important; flex-direction: column !important; - align-items: center !important; justify-content: center !important; - padding: 20px !important; + align-items: center !important; + padding: 32px !important; text-align: center !important; - border-style: dashed !important; - border-width: 1px !important; - color: #000000 !important; - background-color: rgba(0, 0, 0, 0.05) !important; + } + h1 { + color: var(--spectrum-alias-text-color); + } + span { + font-size: var(--font-size-s); + color: var(--grey-6); }