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
|
||||
let enrichedProps = await enrichDataBindings(validProps, totalContext)
|
||||
|
||||
// Enrich button actions if they exist
|
||||
if (props._component?.endsWith("/button") && enrichedProps.onClick) {
|
||||
// Enrich click actions if they exist
|
||||
if (enrichedProps.onClick) {
|
||||
enrichedProps.onClick = enrichButtonActions(
|
||||
enrichedProps.onClick,
|
||||
totalContext
|
||||
|
|
|
@ -330,6 +330,11 @@
|
|||
"label": "Color",
|
||||
"key": "color",
|
||||
"defaultValue": "#000"
|
||||
},
|
||||
{
|
||||
"type": "event",
|
||||
"label": "On Click",
|
||||
"key": "onClick"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
export let icon = ""
|
||||
export let size = "fa-lg"
|
||||
export let color = "#f00"
|
||||
export let onClick
|
||||
|
||||
$: styles = {
|
||||
...$component.styles,
|
||||
|
@ -17,4 +18,4 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<i use:styleable={styles} class="{icon} {size}" />
|
||||
<i use:styleable={styles} class="{icon} {size}" on:click={onClick} />
|
||||
|
|
Loading…
Reference in New Issue