Browse Source

Ensure new components are created with any default styles already applied

gh-pages
Andrew Kingston 6 years ago
parent
commit
3778589d0f
  1. 13
      packages/builder/src/components/userInterface/assetParsing/createProps.js

13
packages/builder/src/components/userInterface/assetParsing/createProps.js

@ -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

Loading…
Cancel
Save