Containers support onClick

This commit is contained in:
Mel O'Hagan 2022-05-11 14:03:08 +01:00
parent 87e9a6940b
commit 844463b312
2 changed files with 17 additions and 1 deletions

View File

@ -219,6 +219,11 @@
"showInBar": true,
"barIcon": "ModernGridView",
"barTitle": "Wrap"
},
{
"type": "event",
"label": "On Click",
"key": "onClick"
}
]
},

View File

@ -10,22 +10,30 @@
export let size
export let gap
export let wrap
export let onClick
$: directionClass = direction ? `valid-container direction-${direction}` : ""
$: hAlignClass = hAlign ? `hAlign-${hAlign}` : ""
$: vAlignClass = vAlign ? `vAlign-${vAlign}` : ""
$: sizeClass = size ? `size-${size}` : ""
$: gapClass = gap ? `gap-${gap}` : ""
$: clickableClass = onClick ? "clickable" : ""
$: classNames = [
directionClass,
hAlignClass,
vAlignClass,
sizeClass,
gapClass,
clickableClass,
].join(" ")
</script>
<div class={classNames} use:styleable={$component.styles} class:wrap>
<div
class={classNames}
use:styleable={$component.styles}
class:wrap
on:click={onClick}
>
<slot />
</div>
@ -104,4 +112,7 @@
.wrap {
flex-wrap: wrap;
}
.clickable {
cursor: pointer;
}
</style>