1
0
Fork 0
mirror of synced 2024-07-01 12:30:41 +12:00

Change of structure for _styles

This commit is contained in:
Conor_Mack 2020-05-22 15:30:29 +01:00
parent d5a27c08a0
commit dd14dd6de2
8 changed files with 29 additions and 15 deletions

View file

@ -135,9 +135,11 @@ const apply_class = (id, name, styles) => `.${name}-${id} {\n${styles}\n}`
//USED IN MULTIPLE PLACES IN THE BUILDER STORE
export const generate_screen_css = component_array => {
let styles = ""
let emptyStyles = {}
let emptyStyles = { normal: {}, hover: {}, active: {}, selected: {} }
for (let i = 0; i < component_array.length; i += 1) {
const { _styles, _id, _children } = component_array[i]
const { _styles, _id, _children, _component } = component_array[i]
// let [componentName] = _component.match(/[a-z]*$/)
debugger
const cssString = generate_css(_styles || emptyStyles) || ""
if (cssString) {
styles += apply_class(_id, "element", cssString)

View file

@ -60,7 +60,7 @@
_children: [
{
_component: "@budibase/standard-components/container",
_styles: {},
_styles: { normal: {}, hover: {}, active: {}, selected: {} },
_id: "__screenslot__text",
_code: "",
className: "",
@ -69,7 +69,12 @@
_children: [
{
_component: "@budibase/standard-components/text",
_styles: {},
_styles: {
normal: {},
hover: {},
active: {},
selected: {},
},
_id: "__screenslot__text_2",
_code: "",
text: "content",

View file

@ -7,7 +7,7 @@
export let componentDefinition = {}
export let onStyleChanged = () => {}
let selectedCategory = "desktop"
let selectedCategory = "normal"
const getProperties = name => panelDefinition[name]
@ -16,8 +16,7 @@
}
const buttonProps = [
{ value: "desktop", text: "Desktop" },
{ value: "mobile", text: "Mobile" },
{ value: "normal", text: "Normal" },
{ value: "hover", text: "Hover" },
{ value: "active", text: "Active" },
{ value: "selected", text: "Selected" },
@ -38,6 +37,7 @@
<PropertyGroup
name={groupName}
properties={getProperties(groupName)}
styleCategory={selectedCategory}
{onStyleChanged}
{componentDefinition}
{componentInstance} />

View file

@ -3,6 +3,7 @@
import PropertyControl from "./PropertyControl.svelte"
export let name = ""
export let styleCategory = "normal"
export let properties = []
export let componentInstance = {}
export let onStyleChanged = () => {}

View file

@ -24,7 +24,7 @@ export const createProps = (componentDefinition, derivedFromProps) => {
const props = {
_id: uuid(),
_component: componentDefinition._component,
_styles: {},
_styles: { normal: {}, hover: {}, active: {}, selected: {} },
_code: "",
}
@ -71,7 +71,7 @@ export const makePropsSafe = (componentDefinition, props) => {
}
if (!props._styles) {
props._styles = {}
props._styles = { normal: {}, hover: {}, active: {}, selected: {} }
}
return props

View file

@ -9,8 +9,10 @@
"_id": 0,
"type": "div",
"_styles": {
"layout": {},
"position": {}
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": ""
},

View file

@ -9,8 +9,10 @@
"_id": 1,
"type": "div",
"_styles": {
"layout": {},
"position": {}
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": ""
},

View file

@ -9,8 +9,10 @@
"_id": 0,
"type": "div",
"_styles": {
"layout": {},
"position": {}
"normal": {},
"hover": {},
"active": {},
"selected": {}
},
"_code": ""
},