From 6d70cfd1c1bd1e2f6b285baa4e05713f060f4704 Mon Sep 17 00:00:00 2001 From: Conor_Mack Date: Thu, 7 May 2020 14:30:04 +0100 Subject: [PATCH] Properties panel structure complete --- .../src/components/common/Input.svelte | 5 +- .../ComponentPropertiesPanel.svelte | 86 +-------------- .../ComponentsPaneSwitcher.svelte | 5 +- .../userInterface/DesignView.svelte | 57 ++++++++-- .../userInterface/FlatButton.svelte | 38 +++++++ .../userInterface/FlatButtonGroup.svelte | 54 +++++++++ .../userInterface/OptionSelect.svelte | 22 ++++ .../userInterface/PropertyControl.svelte | 41 +++++++ .../userInterface/PropertyGroup.svelte | 52 ++++----- .../userInterface/TempSelect.svelte | 14 --- .../userInterface/UserInterfaceRoot.svelte | 4 +- .../userInterface/propertyCategories.js | 103 +++++++++++------- .../userInterface/temporaryPanelStructure.js | 6 +- 13 files changed, 305 insertions(+), 182 deletions(-) create mode 100644 packages/builder/src/components/userInterface/FlatButton.svelte create mode 100644 packages/builder/src/components/userInterface/FlatButtonGroup.svelte create mode 100644 packages/builder/src/components/userInterface/OptionSelect.svelte create mode 100644 packages/builder/src/components/userInterface/PropertyControl.svelte delete mode 100644 packages/builder/src/components/userInterface/TempSelect.svelte diff --git a/packages/builder/src/components/common/Input.svelte b/packages/builder/src/components/common/Input.svelte index 50b07f41f0..bc6741e0d8 100644 --- a/packages/builder/src/components/common/Input.svelte +++ b/packages/builder/src/components/common/Input.svelte @@ -1,8 +1,11 @@ - + diff --git a/packages/builder/src/components/userInterface/ComponentsPaneSwitcher.svelte b/packages/builder/src/components/userInterface/ComponentsPaneSwitcher.svelte index 9ca5b1e122..8e72a17c54 100644 --- a/packages/builder/src/components/userInterface/ComponentsPaneSwitcher.svelte +++ b/packages/builder/src/components/userInterface/ComponentsPaneSwitcher.svelte @@ -24,13 +24,13 @@ @@ -55,6 +55,7 @@ display: flex; flex-direction: column; padding: 20px 0; + border-left: solid 1px #e8e8ef; } .switcher { diff --git a/packages/builder/src/components/userInterface/DesignView.svelte b/packages/builder/src/components/userInterface/DesignView.svelte index 0aebd7b186..7fc6af5312 100644 --- a/packages/builder/src/components/userInterface/DesignView.svelte +++ b/packages/builder/src/components/userInterface/DesignView.svelte @@ -1,23 +1,62 @@ -{#each propertyGroupNames as groupName} - -{/each} +
+ +
+ +
+ +
+ {#each propertyGroupNames as groupName} + + {/each} +
+
+ + diff --git a/packages/builder/src/components/userInterface/FlatButton.svelte b/packages/builder/src/components/userInterface/FlatButton.svelte new file mode 100644 index 0000000000..abc4a3dc28 --- /dev/null +++ b/packages/builder/src/components/userInterface/FlatButton.svelte @@ -0,0 +1,38 @@ + + +
onClick(value || text)}> + {#if useIcon} + + {:else} + {text} + {/if} +
+ + diff --git a/packages/builder/src/components/userInterface/FlatButtonGroup.svelte b/packages/builder/src/components/userInterface/FlatButtonGroup.svelte new file mode 100644 index 0000000000..f16d832c67 --- /dev/null +++ b/packages/builder/src/components/userInterface/FlatButtonGroup.svelte @@ -0,0 +1,54 @@ + + +
+ {#each buttonProps as props} +
+ +
+ {/each} +
+ + diff --git a/packages/builder/src/components/userInterface/OptionSelect.svelte b/packages/builder/src/components/userInterface/OptionSelect.svelte new file mode 100644 index 0000000000..cbbdb8f91f --- /dev/null +++ b/packages/builder/src/components/userInterface/OptionSelect.svelte @@ -0,0 +1,22 @@ + + + diff --git a/packages/builder/src/components/userInterface/PropertyControl.svelte b/packages/builder/src/components/userInterface/PropertyControl.svelte new file mode 100644 index 0000000000..23dd223de6 --- /dev/null +++ b/packages/builder/src/components/userInterface/PropertyControl.svelte @@ -0,0 +1,41 @@ + + +
+
{label}
+
+ +
+
+ + diff --git a/packages/builder/src/components/userInterface/PropertyGroup.svelte b/packages/builder/src/components/userInterface/PropertyGroup.svelte index fa6dba0156..96d5ba7a7b 100644 --- a/packages/builder/src/components/userInterface/PropertyGroup.svelte +++ b/packages/builder/src/components/userInterface/PropertyGroup.svelte @@ -1,28 +1,27 @@ - -
{}}> -
+
+
(show = !show)}>
@@ -31,17 +30,14 @@
{#each propertyDefinition as [key, definition]} -
- {#if propExistsOnComponentDef(key)} - {definition.label || capitalize(key)} - - {/if} -
+ + onChange(key, value)} + props={{ ...excludeProps(definition, ['control']) }} /> + {/each}
@@ -63,14 +59,19 @@ flex-flow: row nowrap; } - .icon { - flex: 0 0 20px; - text-align: center; - } - .name { flex: 1; text-align: left; + padding-top: 2px; + font-size: 14px; + font-weight: 500; + letter-spacing: 0.14px; + color: #393c44; + } + + .icon { + flex: 0 0 20px; + text-align: center; } .property-panel { @@ -78,11 +79,6 @@ overflow: hidden; } - .property-control { - display: flex; - flex-flow: row nowrap; - } - .show { overflow: auto; height: auto; diff --git a/packages/builder/src/components/userInterface/TempSelect.svelte b/packages/builder/src/components/userInterface/TempSelect.svelte deleted file mode 100644 index 514c9b5a20..0000000000 --- a/packages/builder/src/components/userInterface/TempSelect.svelte +++ /dev/null @@ -1,14 +0,0 @@ - - - diff --git a/packages/builder/src/components/userInterface/UserInterfaceRoot.svelte b/packages/builder/src/components/userInterface/UserInterfaceRoot.svelte index 4f32c55d24..13d7a7e2a1 100644 --- a/packages/builder/src/components/userInterface/UserInterfaceRoot.svelte +++ b/packages/builder/src/components/userInterface/UserInterfaceRoot.svelte @@ -114,7 +114,7 @@ .root { display: grid; - grid-template-columns: 275px 1fr 275px; + grid-template-columns: 275px 1fr 300px; height: 100%; width: 100%; background: #fafafa; @@ -151,7 +151,7 @@ .components-pane { grid-column: 3; background-color: var(--white); - min-height: 0px; + height: 100vh; overflow-y: scroll; } diff --git a/packages/builder/src/components/userInterface/propertyCategories.js b/packages/builder/src/components/userInterface/propertyCategories.js index 6246462ecb..525738f02f 100644 --- a/packages/builder/src/components/userInterface/propertyCategories.js +++ b/packages/builder/src/components/userInterface/propertyCategories.js @@ -1,75 +1,102 @@ -import ColorPicker from "../common/Colorpicker.svelte" import Input from "../common/Input.svelte" -import TempSelect from "./TempSelect.svelte" +import OptionSelect from "./OptionSelect.svelte" /* - TODO: all strings types are really inputs and could be typed as such - TODO: Options types need option items TODO: Allow for default values for all properties */ export const general = { - text: { control: Input } + text: { control: Input }, } export const layout = { - flexDirection: { label: "Direction", control: "string" }, - justifyContent: { label: "Justify", control: "string" }, - alignItems: { label: "Align", control: "string" }, - flexWrap: { label: "Wrap", control: "options" }, + flexDirection: { + label: "Direction", + control: OptionSelect, + initialValue: "columnReverse", + options: [ + { label: "row" }, + { label: "row-reverse", value: "rowReverse" }, + { label: "column" }, + { label: "column-reverse", value: "columnReverse" }, + ], + }, + justifyContent: { label: "Justify", control: Input }, + alignItems: { label: "Align", control: Input }, + flexWrap: { + label: "Wrap", + control: OptionSelect, + options: [{ label: "wrap" }, { label: "no wrap", value: "noWrap" }], + }, } export const spacing = { - padding: { control: "string" }, - margin: { control: "string" }, + padding: { control: Input }, + margin: { control: Input }, } export const size = { - width: { control: "string" }, - height: { control: "string" }, - minWidth: { label: "Min W", control: "string" }, - minHeight: { label: "Min H", control: "string" }, - maxWidth: { label: "Max W", control: "string" }, - maxHeight: { label: "Max H", control: "string" }, - overflow: { control: "string" }, //custom + width: { control: Input }, + height: { control: Input }, + minWidth: { label: "Min W", control: Input }, + minHeight: { label: "Min H", control: Input }, + maxWidth: { label: "Max W", control: Input }, + maxHeight: { label: "Max H", control: Input }, + overflow: { control: Input }, //custom } export const position = { - position: { control: "options" }, + position: { control: Input }, } export const typography = { - font: { control: "options" }, - weight: { control: "options" }, - size: { control: "string" }, - lineHeight: { label: "Line H", control: "string" }, - color: { control: "colour" }, - align: { control: "string" }, //custom - transform: { control: "string" }, //custom - style: { control: "string" }, //custom + font: { control: Input }, + weight: { control: Input }, + size: { control: Input }, + lineHeight: { label: "Line H", control: Input }, + color: { + control: OptionSelect, + options: [{ label: "red" }, { label: "blue" }, { label: "green" }], + }, + align: { control: Input }, //custom + transform: { control: Input }, //custom + style: { control: Input }, //custom } export const background = { - backgroundColor: { label: "Background Color", control: ColorPicker }, + backgroundColor: { label: "Background Color", control: Input }, image: { control: Input }, //custom } export const border = { - radius: { control: "string" }, - width: { control: "string" }, //custom - color: { control: "colour" }, - style: { control: "options" }, + radius: { control: Input }, + width: { control: Input }, //custom + color: { control: Input }, + style: { control: Input }, } export const effects = { - opacity: "string", - rotate: "string", - shadow: "string", + opacity: { control: Input }, + rotate: { control: Input }, + shadow: { control: Input }, } export const transitions = { - property: { control: "options" }, - duration: { control: "string" }, - ease: { control: "options" }, + property: { control: Input }, + duration: { control: Input }, + ease: { control: Input }, +} + +export const all = { + general, + layout, + spacing, + size, + position, + typography, + background, + border, + effects, + transitions, } export function excludeProps(props, propsToExclude) { diff --git a/packages/builder/src/components/userInterface/temporaryPanelStructure.js b/packages/builder/src/components/userInterface/temporaryPanelStructure.js index bc60ac2bd6..c4426d1035 100644 --- a/packages/builder/src/components/userInterface/temporaryPanelStructure.js +++ b/packages/builder/src/components/userInterface/temporaryPanelStructure.js @@ -1,4 +1,4 @@ -import { general, layout, background } from "./propertyCategories.js" +import { general, layout, typography, background, all } from "./propertyCategories.js" export default { categories: [ @@ -13,7 +13,7 @@ export default { icon: 'ri-layout-row-fill', commonProps: {}, children: [], - properties: { background }, + properties: { ...all }, }, { name: 'Text', @@ -29,7 +29,7 @@ export default { properties: { general, layout, - background, + typography, }, }, {