2023-12-15 16:17:33 +00:00
|
|
|
<script lang="ts" setup>
|
2023-10-31 14:38:43 +00:00
|
|
|
import BaseIcon from '@/Components/BaseIcon.vue';
|
2023-12-15 16:17:33 +00:00
|
|
|
import { computed } from 'vue';
|
|
|
|
import { stardust } from '@eidellev/adonis-stardust/client';
|
2023-03-03 15:54:28 +00:00
|
|
|
|
2023-12-15 16:17:33 +00:00
|
|
|
const props = defineProps({
|
2023-10-31 14:38:43 +00:00
|
|
|
icon: {
|
|
|
|
type: String,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
label: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
2023-12-15 16:17:33 +00:00
|
|
|
size: {
|
|
|
|
type: [String, Number],
|
|
|
|
default: 16,
|
|
|
|
},
|
2023-10-31 14:38:43 +00:00
|
|
|
isDesktopIconOnly: Boolean,
|
2023-12-15 16:17:33 +00:00
|
|
|
isHoverLabelOnly: Boolean,
|
|
|
|
routeName: {
|
|
|
|
type: String,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
const active = computed(() => {
|
|
|
|
if (props.routeName && stardust.isCurrent(props.routeName)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const componentClass = computed(() => {
|
|
|
|
const base = [
|
|
|
|
// props.type,
|
|
|
|
'flex',
|
|
|
|
];
|
|
|
|
if (props.isHoverLabelOnly ) {
|
|
|
|
base.push(' flex-col items-center');
|
|
|
|
}
|
|
|
|
|
|
|
|
return base;
|
|
|
|
});
|
|
|
|
|
|
|
|
const labelClass = computed(() => {
|
|
|
|
const base = [
|
|
|
|
// props.type,
|
|
|
|
'transition',
|
|
|
|
];
|
|
|
|
|
|
|
|
if (props.isDesktopIconOnly && props.icon) {
|
|
|
|
base.push('lg:hidden');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (props.isHoverLabelOnly && active.value == false) {
|
|
|
|
base.push('hidden');
|
|
|
|
} else if(props.isHoverLabelOnly && active.value == true) {
|
|
|
|
base.push('display-block');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return base;
|
2023-10-31 14:38:43 +00:00
|
|
|
});
|
2023-03-03 15:54:28 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2023-12-15 16:17:33 +00:00
|
|
|
<div :class="componentClass">
|
|
|
|
<slot />
|
|
|
|
<BaseIcon v-if="icon" :path="props.icon" class="transition-colors" :size="props.size" />
|
|
|
|
<!-- <span class="px-2 transition-colors" :class="{ 'lg:hidden': isDesktopIconOnly && props.icon }">{{ props.label }}</span> -->
|
|
|
|
<span class="px-2 transition-colors" :class="labelClass">{{ props.label }}</span>
|
|
|
|
</div>
|
2023-03-03 15:54:28 +00:00
|
|
|
</template>
|
2023-12-15 16:17:33 +00:00
|
|
|
|
|
|
|
<!-- <style lang="css" scoped>
|
|
|
|
.app-menu-entry__active {
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
.app-menu-entry__active::before {
|
|
|
|
/* content: "___"; */
|
|
|
|
position: absolute;
|
|
|
|
pointer-events: none;
|
|
|
|
/* border-bottom-color: var(--color-main-background); */
|
|
|
|
/* transform: translateX(-50%); */
|
|
|
|
width: 100%;
|
|
|
|
/* height: 5px; */
|
|
|
|
border-radius: 3px;
|
|
|
|
border-bottom: 2px;
|
|
|
|
/* background-color: var(--color-primary-element-text); */
|
|
|
|
/* left: 50%; */
|
|
|
|
bottom: 6px;
|
|
|
|
display: block;
|
|
|
|
transition: all 0.1s ease-in-out;
|
|
|
|
opacity: 1;
|
|
|
|
}
|
|
|
|
</style> -->
|