From 78b5e7707dde22b55534ea889754130ba2e34aaf Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 10 May 2022 14:54:53 +0100 Subject: [PATCH] Add screen width setting with backwards compatibility --- .../_components/ScreenSettingsPanel.svelte | 10 ++++++ .../client/src/components/app/Layout.svelte | 36 +++++++++++++------ packages/client/src/stores/screens.js | 7 ++-- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenSettingsPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenSettingsPanel.svelte index 850b56eac4..74ff403aa7 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenSettingsPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/screens/_components/ScreenSettingsPanel.svelte @@ -9,6 +9,7 @@ Toggle, Checkbox, Banner, + Select, notifications, } from "@budibase/bbui" import PropertyControl from "components/design/settings/controls/PropertyControl.svelte" @@ -135,6 +136,15 @@ text: "Show navigation", }, }, + { + key: "width", + label: "Width", + control: Select, + props: { + options: ["Extra small", "Small", "Medium", "Large", "Max"], + placeholder: "Default", + }, + }, ] const removeCustomLayout = async () => { diff --git a/packages/client/src/components/app/Layout.svelte b/packages/client/src/components/app/Layout.svelte index a7733c035f..fccdef7dcc 100644 --- a/packages/client/src/components/app/Layout.svelte +++ b/packages/client/src/components/app/Layout.svelte @@ -23,17 +23,19 @@ export let navBackground export let navTextColor export let navWidth + export let pageWidth const NavigationClasses = { Top: "top", Left: "left", None: "none", } - const WidthStyles = { - Max: "100%", - Large: "1400px", - Medium: "1100px", - Small: "800px", + const WidthClasses = { + Max: "max", + Large: "l", + Medium: "m", + Small: "s", + "Extra small": "xs", } // Set some layout context. This isn't used in bindings but can be used @@ -48,8 +50,8 @@ $: validLinks = links?.filter(link => link.text && link.url) || [] $: typeClass = NavigationClasses[navigation] || NavigationClasses.None - $: navWidthStyle = WidthStyles[navWidth || width] || WidthStyles.Large - $: pageWidthStyle = WidthStyles[width] || WidthStyles.Max + $: navWidthClass = WidthClasses[navWidth || width] || WidthClasses.Large + $: pageWidthClass = WidthClasses[pageWidth || width] || WidthClasses.Large $: navStyle = getNavStyle( navBackground, navTextColor, @@ -116,7 +118,7 @@ on:click={$builderStore.inBuilder ? builderStore.actions.clickNav : null} style={navStyle} > -