From 2b3ce7b34dd16b8e92e73383dfdf0c798e17da24 Mon Sep 17 00:00:00 2001 From: Conor_Mack Date: Fri, 8 May 2020 09:57:41 +0100 Subject: [PATCH] Style binding options and property categories --- .../userInterface/OptionSelect.svelte | 13 +++- .../userInterface/propertyCategories.js | 75 ++++++++++++++++--- 2 files changed, 75 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/components/userInterface/OptionSelect.svelte b/packages/builder/src/components/userInterface/OptionSelect.svelte index cbbdb8f91f..b3cfa5e54b 100644 --- a/packages/builder/src/components/userInterface/OptionSelect.svelte +++ b/packages/builder/src/components/userInterface/OptionSelect.svelte @@ -4,6 +4,9 @@ export let onChange = value => {} export let options = [] export let initialValue = "" + export let styleBindingProperty = "" + + $: bindOptionToStyle = !!styleBindingProperty onMount(() => { if (!value && !!initialValue) { @@ -17,6 +20,14 @@ {value} on:change={ev => onChange(ev.target.value)}> {#each options as { value, label }} - + {#if bindOptionToStyle} + + {:else} + + {/if} {/each} diff --git a/packages/builder/src/components/userInterface/propertyCategories.js b/packages/builder/src/components/userInterface/propertyCategories.js index 525738f02f..7505645b65 100644 --- a/packages/builder/src/components/userInterface/propertyCategories.js +++ b/packages/builder/src/components/userInterface/propertyCategories.js @@ -41,25 +41,76 @@ export const size = { minHeight: { label: "Min H", control: Input }, maxWidth: { label: "Max W", control: Input }, maxHeight: { label: "Max H", control: Input }, - overflow: { control: Input }, //custom + overflow: { + control: OptionSelect, + options: [ + { label: "visible" }, + { label: "auto" }, + { label: "hidden" }, + { label: "auto" }, + { label: "scroll" }, + ], + }, //custom } export const position = { - position: { control: Input }, + position: { + control: OptionSelect, + options: [ + { label: "static" }, + { label: "relative" }, + { label: "fixed" }, + { label: "absolute" }, + { label: "sticky" }, + ], + }, } export const typography = { - font: { control: Input }, - weight: { control: Input }, - size: { control: Input }, + fontFamily: { + label: "Font", + control: OptionSelect, + options: [ + { label: "initial" }, + { label: "Times New Roman" }, + { label: "Georgia" }, + { label: "Arial" }, + { label: "Arial Black" }, + { label: "Comic Sans MS" }, + { label: "Impact" }, + { label: "Lucida Sans Unicode" }, + ], + styleBindingProperty: "font-family", + }, + fontWeight: { + label: "weight", + control: OptionSelect, + options: [ + { label: "normal" }, + { label: "bold" }, + { label: "bolder" }, + { label: "lighter" }, + ], + }, + fontSize: { label: "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 + textAlign: { + label: "align", + control: OptionSelect, + options: [ + { label: "initial" }, + { label: "left" }, + { label: "right" }, + { label: "center" }, + { label: "justify" }, + ], + }, //custom + textTransform: { label: "transform", control: Input }, //custom + fontStyle: { label: "style", control: Input }, //custom } export const background = { @@ -68,10 +119,10 @@ export const background = { } export const border = { - radius: { control: Input }, - width: { control: Input }, //custom - color: { control: Input }, - style: { control: Input }, + borderRadius: { label: "radius", control: Input }, + borderWidth: { label: "width", control: Input }, //custom + borderColor: { label: "color", control: Input }, + borderStyle: { label: "style", control: Input }, } export const effects = {