playground(alert): improve actions color

This commit is contained in:
Benjamin Canac
2024-06-04 14:06:14 +02:00
parent ad70bb9a59
commit 57b32ca9b6

View File

@@ -3,8 +3,9 @@ import theme from '#build/ui/alert'
const variants = Object.keys(theme.variants.variant)
const actions = [{
const actions = (variant?: string) => [{
label: 'Action',
color: (variant === 'solid' ? 'black' as const : 'primary' as const),
click() {
console.log('Action clicked')
}
@@ -14,7 +15,7 @@ const data = {
title: 'Heads up!',
description: 'You can add components to your app using the cli.',
icon: 'i-heroicons-command-line',
actions,
actions: actions(),
close: true
}
</script>
@@ -30,6 +31,13 @@ const data = {
<UAlert v-bind="data" color="white" />
<UAlert v-bind="data" color="gray" />
<UAlert v-bind="data" color="black" />
<UAlert v-for="variant in variants" :key="variant" v-bind="data" color="primary" :variant="(variant as any)" />
<UAlert
v-for="variant in variants"
:key="variant"
v-bind="data"
:actions="actions(variant)"
color="primary"
:variant="(variant as any)"
/>
</div>
</template>