From e6fbdc2646fd8e4fcecf7a778d72163b59dfc194 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 6 Mar 2020 17:00:54 +0000 Subject: [PATCH] icons instead of text --- .../builder/src/builderStore/generate_css.js | 22 ++++- packages/builder/src/builderStore/index.js | 1 - packages/builder/src/index.html | 1 + .../ComponentPropertiesPanel.svelte | 2 +- .../src/userInterface/LayoutEditor.svelte | 29 ++++--- .../LayoutTemplateControls.svelte | 81 +++++++++++++++++++ 6 files changed, 123 insertions(+), 13 deletions(-) create mode 100644 packages/builder/src/userInterface/LayoutTemplateControls.svelte diff --git a/packages/builder/src/builderStore/generate_css.js b/packages/builder/src/builderStore/generate_css.js index 2c0fa48406..53a7b22c12 100644 --- a/packages/builder/src/builderStore/generate_css.js +++ b/packages/builder/src/builderStore/generate_css.js @@ -29,6 +29,18 @@ const css_map = { name: "grid-template-columns", generate: self, }, + align: { + name: "align-items", + generate: self, + }, + justify: { + name: "justify-content", + generate: self, + }, + direction: { + name: "flex-direction", + generate: self + }, gridarea: { name: "grid-area", generate: make_margin, @@ -90,6 +102,12 @@ const handle_grid = (acc, [name, value]) => { return acc.concat([[name, value]]) } +// const handleFlex = (acc, [name, value]) => { +// if (name === "align-items" || name === "justify-content") { +// return acc.concat([name, value]) +// } +// }; + const object_to_css_string = [ toPairs, reduce(handle_grid, []), @@ -100,7 +118,9 @@ const object_to_css_string = [ export const generate_css = ({ layout, position }) => { let _layout = pipe(layout, object_to_css_string) - _layout = _layout.length ? _layout + "\ndisplay: grid;" : _layout + if (_layout.length) { + _layout += `\ndisplay: ${_layout.includes("flex") ? "flex" : "grid"};`; + } return { layout: _layout, diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index dacb186952..e3bc0b089c 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -5,7 +5,6 @@ export const store = getStore() export const initialise = async () => { try { - console.log(process.env.NODE_ENV); if (process.env.NODE_ENV === "production") { LogRocket.init("knlald/budibase"); } diff --git a/packages/builder/src/index.html b/packages/builder/src/index.html index 8ce642e160..94a1f16944 100644 --- a/packages/builder/src/index.html +++ b/packages/builder/src/index.html @@ -6,6 +6,7 @@ Budibase Builder + diff --git a/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte b/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte index 6b39d7b5ee..4fa7b092bd 100644 --- a/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte +++ b/packages/builder/src/userInterface/ComponentPropertiesPanel.svelte @@ -29,7 +29,7 @@ $store.currentFrontEndType === "page" ? getProps($store.currentPreviewItem, ["name", "favicon"]) : getProps($store.currentPreviewItem, ["name", "description", "route"]) - $: console.log(screen_props) + const onPropChanged = store.setComponentProp const onStyleChanged = store.setComponentStyle diff --git a/packages/builder/src/userInterface/LayoutEditor.svelte b/packages/builder/src/userInterface/LayoutEditor.svelte index 98f43fd59e..44ae3c0d40 100644 --- a/packages/builder/src/userInterface/LayoutEditor.svelte +++ b/packages/builder/src/userInterface/LayoutEditor.svelte @@ -1,5 +1,6 @@ + +
+ {#each meta as { placeholder }, i} + {#each propertyChoices as [displayName, [cssPropValue, icon]]} + + {/each} + {/each} +
+ +