Merge branch 'master' into feat/BUDI-8046
This commit is contained in:
commit
ec64569968
|
@ -1137,6 +1137,12 @@
|
||||||
"key": "color",
|
"key": "color",
|
||||||
"showInBar": true
|
"showInBar": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "color",
|
||||||
|
"label": "Text Color",
|
||||||
|
"key": "textColor",
|
||||||
|
"showInBar": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"label": "Allow delete",
|
"label": "Allow delete",
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
export let onClick
|
export let onClick
|
||||||
export let text = ""
|
export let text = ""
|
||||||
export let color
|
export let color
|
||||||
|
export let textColor
|
||||||
export let closable = false
|
export let closable = false
|
||||||
export let size = "M"
|
export let size = "M"
|
||||||
|
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
|
|
||||||
// Add color styles to main styles object, otherwise the styleable helper
|
// Add color styles to main styles object, otherwise the styleable helper
|
||||||
// overrides the color when it's passed as inline style.
|
// overrides the color when it's passed as inline style.
|
||||||
$: styles = enrichStyles($component.styles, color)
|
$: styles = enrichStyles($component.styles, color, textColor)
|
||||||
$: componentText = getComponentText(text, $builderStore, $component)
|
$: componentText = getComponentText(text, $builderStore, $component)
|
||||||
|
|
||||||
const getComponentText = (text, builderState, componentState) => {
|
const getComponentText = (text, builderState, componentState) => {
|
||||||
|
@ -24,7 +25,7 @@
|
||||||
return text || componentState.name || "Placeholder text"
|
return text || componentState.name || "Placeholder text"
|
||||||
}
|
}
|
||||||
|
|
||||||
const enrichStyles = (styles, color) => {
|
const enrichStyles = (styles, color, textColor) => {
|
||||||
if (!color) {
|
if (!color) {
|
||||||
return styles
|
return styles
|
||||||
}
|
}
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
...styles?.normal,
|
...styles?.normal,
|
||||||
"background-color": color,
|
"background-color": color,
|
||||||
"border-color": color,
|
"border-color": color,
|
||||||
color: "white",
|
color: textColor || "white",
|
||||||
"--spectrum-clearbutton-medium-icon-color": "white",
|
"--spectrum-clearbutton-medium-icon-color": "white",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue