Add onclick handler to icons
This commit is contained in:
parent
f17e2478e2
commit
dd54bc9771
|
@ -43,8 +43,8 @@ export const enrichProps = async (props, context) => {
|
||||||
// Enrich all data bindings in top level props
|
// Enrich all data bindings in top level props
|
||||||
let enrichedProps = await enrichDataBindings(validProps, totalContext)
|
let enrichedProps = await enrichDataBindings(validProps, totalContext)
|
||||||
|
|
||||||
// Enrich button actions if they exist
|
// Enrich click actions if they exist
|
||||||
if (props._component?.endsWith("/button") && enrichedProps.onClick) {
|
if (enrichedProps.onClick) {
|
||||||
enrichedProps.onClick = enrichButtonActions(
|
enrichedProps.onClick = enrichButtonActions(
|
||||||
enrichedProps.onClick,
|
enrichedProps.onClick,
|
||||||
totalContext
|
totalContext
|
||||||
|
|
|
@ -330,6 +330,11 @@
|
||||||
"label": "Color",
|
"label": "Color",
|
||||||
"key": "color",
|
"key": "color",
|
||||||
"defaultValue": "#000"
|
"defaultValue": "#000"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "event",
|
||||||
|
"label": "On Click",
|
||||||
|
"key": "onClick"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
export let icon = ""
|
export let icon = ""
|
||||||
export let size = "fa-lg"
|
export let size = "fa-lg"
|
||||||
export let color = "#f00"
|
export let color = "#f00"
|
||||||
|
export let onClick
|
||||||
|
|
||||||
$: styles = {
|
$: styles = {
|
||||||
...$component.styles,
|
...$component.styles,
|
||||||
|
@ -17,4 +18,4 @@
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<i use:styleable={styles} class="{icon} {size}" />
|
<i use:styleable={styles} class="{icon} {size}" on:click={onClick} />
|
||||||
|
|
Loading…
Reference in New Issue