Skip to content

Commit 81d17a3

Browse files
committed
feat(list): allow using explicit color for the list items
related: #87
1 parent 08a3509 commit 81d17a3

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<script lang="ts" setup>
2+
const items = [
3+
{
4+
icon: 'i-bx-send',
5+
text: 'Send',
6+
},
7+
{
8+
icon: 'i-bx-edit',
9+
text: 'Edit',
10+
},
11+
{
12+
icon: 'i-bx-trash',
13+
text: 'Delete',
14+
color: 'danger', // [!code hl]
15+
},
16+
]
17+
</script>
18+
19+
<template>
20+
<div class="max-w-550px">
21+
<ABtn
22+
icon="i-bx-file"
23+
append-icon="i-bx-chevron-down"
24+
>
25+
Invoice
26+
<AMenu>
27+
<!-- ℹ️ `model-value="null"` will be all list items clickable -->
28+
<AList
29+
:model-value="null"
30+
:items="items"
31+
/>
32+
</AMenu>
33+
</ABtn>
34+
</div>
35+
</template>

docs/components/ui/user/UIUserUserMenu.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ const items = [
3131
class="cursor-pointer"
3232
>
3333
<AMenu>
34+
<!-- ℹ️ `model-value="null"` will be all list items clickable -->
3435
<AList
3536
:model-value="null"
3637
:items="items"

docs/ui/misc.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@
1818
:::
1919

2020
::::
21+
22+
::::card Colored Actions Menu {bordered}
23+
24+
<br>
25+
26+
:::code UIMiscColoredActionsMenu
27+
<<< @/components/ui/misc/UIMiscColoredActionsMenu.vue
28+
:::
29+
30+
::::

packages/anu-vue/src/components/list-item/AListItem.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ else
3131
3232
// useLayer
3333
const { styles, classes } = getLayerClasses(
34-
computed(() => props.isActive ? (props.color || 'primary') : undefined),
34+
computed(() => (props.color ?? props.isActive) ? (props.color || 'primary') : undefined),
3535
computed(() => props.isActive ? (props.variant || 'light') : 'text'),
3636
toRef(props, 'states'),
3737
{ statesClass: 'states:10' },
@@ -59,7 +59,7 @@ const { styles, classes } = getLayerClasses(
5959
>
6060
<i
6161
v-if="props.icon && !props.iconAppend"
62-
class="text-xl"
62+
class="text-lg"
6363
:class="props.icon"
6464
@click="$emit('click:icon')"
6565
/>

packages/anu-vue/src/components/list/AList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function handleListItemClick(item: AListPropItems[number]) {
6464
v-bind="typeof item === 'string' ? {} : item"
6565
:avatar-append="props.avatarAppend"
6666
:icon-append="props.iconAppend"
67-
:color="props.color"
67+
:color="typeof item === 'object' ? item.color : props.color"
6868
:variant="props.variant"
6969
:states="props.states"
7070
:is-active="options[index]?.isSelected as unknown as boolean"

0 commit comments

Comments
 (0)