Files
chatwoot/app/javascript/dashboard/components-next/sidebar/SidebarGroupHeader.vue
Shivam Mishra 6df2d76c1e feat: new colors (#10352)
Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
2024-10-28 14:27:08 +05:30

43 lines
1.2 KiB
Vue

<script setup>
import Icon from 'next/icon/Icon.vue';
defineProps({
to: { type: [Object, String], default: '' },
label: { type: String, default: '' },
icon: { type: [String, Object], default: '' },
expandable: { type: Boolean, default: false },
isExpanded: { type: Boolean, default: false },
isActive: { type: Boolean, default: false },
hasActiveChild: { type: Boolean, default: false },
});
const emit = defineEmits(['toggle']);
</script>
<template>
<component
:is="to ? 'router-link' : 'div'"
class="flex items-center gap-2 px-2 py-1.5 rounded-lg h-8"
role="button"
:to="to"
:title="label"
:class="{
'n-blue-text bg-n-alpha-2 font-medium': isActive && !hasActiveChild,
'text-n-slate-12 font-medium': hasActiveChild,
'text-n-slate-11 hover:bg-n-alpha-2': !isActive && !hasActiveChild,
}"
@click.stop="emit('toggle')"
>
<Icon v-if="icon" :icon="icon" class="size-4" />
<span class="text-sm font-medium leading-5 flex-grow">
{{ label }}
</span>
<span
v-if="expandable"
v-show="isExpanded"
class="i-lucide-chevron-up size-3"
@click.stop="emit('toggle')"
/>
</component>
</template>