1
0
Fork 0
mirror of synced 2024-06-16 17:34:41 +12:00

Add onclick handler to icons

This commit is contained in:
Andrew Kingston 2021-03-25 16:18:19 +00:00
parent a242d19f28
commit 9fddf13be5
3 changed files with 9 additions and 3 deletions

View file

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

View file

@ -330,6 +330,11 @@
"label": "Color",
"key": "color",
"defaultValue": "#000"
},
{
"type": "event",
"label": "On Click",
"key": "onClick"
}
]
},

View file

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