1
0
Fork 0
mirror of synced 2024-09-30 00:57:16 +13:00

Ensure new components are created with any default styles already applied

This commit is contained in:
Andrew Kingston 2021-01-05 11:46:31 +00:00
parent 8a5b7ca287
commit 3778589d0f

View file

@ -2,6 +2,7 @@ import { isString, isUndefined, cloneDeep } from "lodash/fp"
import { TYPE_MAP } from "./types"
import { assign } from "lodash"
import { uuid } from "builderStore/uuid"
import { defaults } from "../propertyCategories"
export const getBuiltin = _component => {
const { props } = createProps({ _component })
@ -24,7 +25,11 @@ export const createProps = (componentDefinition, derivedFromProps) => {
const props = {
_id: uuid(),
_component: componentDefinition._component,
_styles: { normal: {}, hover: {}, active: {}, selected: {} },
_styles: {
normal: defaults,
hover: defaults,
active: defaults,
},
}
const errors = []
@ -75,7 +80,11 @@ export const makePropsSafe = (componentDefinition, props) => {
}
if (!props._styles) {
props._styles = { normal: {}, hover: {}, active: {}, selected: {} }
props._styles = {
normal: defaults,
hover: defaults,
active: defaults,
}
}
return props