2022-12-07 13:31:38 +00:00
|
|
|
<template>
|
2024-04-04 22:20:42 +00:00
|
|
|
<li
|
|
|
|
:class="current && 'current'"
|
2024-04-18 22:21:25 +00:00
|
|
|
class="relative before:right-0 px-6 before:top-1/4 before:w-[4px] before:h-1/2 before:absolute before:rounded-full
|
2024-04-04 22:20:42 +00:00
|
|
|
before:transition-[box-shadow,_background-color] before:ease-in-out before:duration-500"
|
|
|
|
>
|
|
|
|
<a
|
|
|
|
:href="props.href"
|
|
|
|
class="flex items-center overflow-x-hidden gap-3 h-11 relative active:pt-0.5 active:pr-0 active:pb-0 active:pl-0.5
|
|
|
|
!text-k-text-secondary hover:!text-k-text-primary"
|
|
|
|
>
|
|
|
|
<span class="opacity-70">
|
|
|
|
<slot name="icon" />
|
|
|
|
</span>
|
|
|
|
|
|
|
|
<span class="overflow-hidden text-ellipsis whitespace-nowrap">
|
2022-12-07 13:31:38 +00:00
|
|
|
<slot />
|
|
|
|
</span>
|
|
|
|
</a>
|
|
|
|
</li>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-04-04 22:20:42 +00:00
|
|
|
import { ref } from 'vue'
|
|
|
|
import { useRouter } from '@/composables'
|
2022-12-07 13:31:38 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
const props = withDefaults(defineProps<{ href?: string | undefined; screen?: ScreenName | undefined }>(), {
|
|
|
|
href: undefined,
|
|
|
|
screen: undefined
|
|
|
|
})
|
2022-12-07 13:31:38 +00:00
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
const current = ref(false)
|
2022-12-07 13:31:38 +00:00
|
|
|
|
|
|
|
const { onRouteChanged } = useRouter()
|
|
|
|
|
2024-04-04 22:20:42 +00:00
|
|
|
if (screen) {
|
|
|
|
onRouteChanged(route => current.value = route.screen === props.screen)
|
|
|
|
}
|
2022-12-07 13:31:38 +00:00
|
|
|
</script>
|
2024-04-04 22:20:42 +00:00
|
|
|
|
|
|
|
<style lang="postcss" scoped>
|
|
|
|
li.current {
|
|
|
|
a {
|
|
|
|
@apply text-k-text-primary !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
@apply bg-k-highlight !important;
|
|
|
|
box-shadow: 0 0 40px 10px var(--color-highlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|