Ensure new components are created with any default styles already applied
This commit is contained in:
parent
2a478f7f03
commit
4ea8b34ff1
|
@ -2,6 +2,7 @@ import { isString, isUndefined, cloneDeep } from "lodash/fp"
|
||||||
import { TYPE_MAP } from "./types"
|
import { TYPE_MAP } from "./types"
|
||||||
import { assign } from "lodash"
|
import { assign } from "lodash"
|
||||||
import { uuid } from "builderStore/uuid"
|
import { uuid } from "builderStore/uuid"
|
||||||
|
import { defaults } from "../propertyCategories"
|
||||||
|
|
||||||
export const getBuiltin = _component => {
|
export const getBuiltin = _component => {
|
||||||
const { props } = createProps({ _component })
|
const { props } = createProps({ _component })
|
||||||
|
@ -24,7 +25,11 @@ export const createProps = (componentDefinition, derivedFromProps) => {
|
||||||
const props = {
|
const props = {
|
||||||
_id: uuid(),
|
_id: uuid(),
|
||||||
_component: componentDefinition._component,
|
_component: componentDefinition._component,
|
||||||
_styles: { normal: {}, hover: {}, active: {}, selected: {} },
|
_styles: {
|
||||||
|
normal: defaults,
|
||||||
|
hover: defaults,
|
||||||
|
active: defaults,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const errors = []
|
const errors = []
|
||||||
|
@ -75,7 +80,11 @@ export const makePropsSafe = (componentDefinition, props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!props._styles) {
|
if (!props._styles) {
|
||||||
props._styles = { normal: {}, hover: {}, active: {}, selected: {} }
|
props._styles = {
|
||||||
|
normal: defaults,
|
||||||
|
hover: defaults,
|
||||||
|
active: defaults,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return props
|
return props
|
||||||
|
|
Loading…
Reference in New Issue