mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-25 10:46:17 +03:00
refactor: NavSideItem
This commit is contained in:
parent
3cd8fb54dd
commit
cd4658506d
4 changed files with 37 additions and 78 deletions
|
@ -4,12 +4,14 @@ import type { Account } from 'masto'
|
||||||
defineProps<{
|
defineProps<{
|
||||||
account: Account
|
account: Account
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
defineOptions({
|
|
||||||
inheritAttrs: false,
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AccountAvatarImage :account="account" v-bind="$attrs" />
|
<img
|
||||||
|
:src="account.avatar"
|
||||||
|
:alt="account.username"
|
||||||
|
loading="lazy"
|
||||||
|
rounded-full bg-gray:10
|
||||||
|
v-bind="$attrs"
|
||||||
|
>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<script setup lang="ts">
|
|
||||||
import type { Account } from 'masto'
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
account: Account
|
|
||||||
}>()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
|
||||||
<img
|
|
||||||
:src="account.avatar"
|
|
||||||
:alt="account.username"
|
|
||||||
loading="lazy"
|
|
||||||
rounded-full bg-gray:10
|
|
||||||
v-bind="$attrs"
|
|
||||||
>
|
|
||||||
</template>
|
|
|
@ -1,65 +1,21 @@
|
||||||
<script setup lang="ts">
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div px3 py4 flex="~ col gap2" text-lg>
|
<div px3 py4 flex="~ col gap2" text-lg>
|
||||||
<template v-if="currentUser">
|
<template v-if="currentUser">
|
||||||
<NuxtLink to="/home" active-class="text-primary" group focus:outline-none>
|
<NavSideItem text="Home" to="/home" icon="i-ri:home-5-line" />
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
<NavSideItem text="Notifications" to="/notifications" icon="i-ri:notification-4-line" />
|
||||||
<div i-ri:home-5-line />
|
|
||||||
<span>Home</span>
|
|
||||||
</div>
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/notifications" active-class="text-primary" group focus:outline-none>
|
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
|
||||||
<div i-ri:notification-4-line />
|
|
||||||
<span>Notifications</span>
|
|
||||||
</div>
|
|
||||||
</NuxtLink>
|
|
||||||
</template>
|
</template>
|
||||||
<NuxtLink to="/explore" active-class="text-primary" group focus:outline-none>
|
<NavSideItem text="Explore" to="/explore" icon="i-ri:hashtag" />
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
<NavSideItem text="Local" to="/public/local" icon="i-ri:group-2-line " />
|
||||||
<div i-ri:hashtag />
|
<NavSideItem text="Federated" to="/public" icon="i-ri:earth-line" />
|
||||||
<span>Explore</span>
|
|
||||||
</div>
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/public/local" active-class="text-primary" group focus:outline-none>
|
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
|
||||||
<div i-ri:group-2-line />
|
|
||||||
<span>Local</span>
|
|
||||||
</div>
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/public" active-class="text-primary" group focus:outline-none>
|
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
|
||||||
<div i-ri:earth-line />
|
|
||||||
<span>Federated</span>
|
|
||||||
</div>
|
|
||||||
</NuxtLink>
|
|
||||||
<template v-if="currentUser">
|
<template v-if="currentUser">
|
||||||
<NuxtLink to="/conversations" active-class="text-primary" group focus:outline-none>
|
<NavSideItem text="Conversations" to="/conversations" icon="i-ri:at-line" />
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
<NavSideItem text="Favourites" to="/favourites" icon="i-ri:heart-3-line" />
|
||||||
<div i-ri:at-line />
|
<NavSideItem text="Bookmarks" to="/bookmarks" icon="i-ri:bookmark-line " />
|
||||||
<span>Conversations</span>
|
<NavSideItem text="Lists" :to="getAccountPath(currentUser.account)" icon="i-ri:list-check-2-line">
|
||||||
</div>
|
<template #icon>
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/favourites" active-class="text-primary" group focus:outline-none>
|
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
|
||||||
<div i-ri:heart-3-line />
|
|
||||||
<span>Favorites</span>
|
|
||||||
</div>
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/bookmarks" active-class="text-primary" group focus:outline-none>
|
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
|
||||||
<div i-ri:bookmark-line />
|
|
||||||
<span>Bookmarks</span>
|
|
||||||
</div>
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink :to="getAccountPath(currentUser.account)" active-class="text-primary" group focus:outline-none>
|
|
||||||
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
|
||||||
<AccountAvatar :account="currentUser.account" h="1.2em" />
|
<AccountAvatar :account="currentUser.account" h="1.2em" />
|
||||||
<span>Profile</span>
|
</template>
|
||||||
</div>
|
</NavSideItem>
|
||||||
</NuxtLink>
|
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
18
components/nav/NavSideItem.vue
Normal file
18
components/nav/NavSideItem.vue
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
text: string
|
||||||
|
icon: string
|
||||||
|
to: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<NuxtLink :to="to" active-class="text-primary" group focus:outline-none>
|
||||||
|
<div flex w-fit px5 py2 gap2 items-center transition-100 rounded-10 group-hover:bg-active group-focus-visible:ring="2 current">
|
||||||
|
<slot name="icon">
|
||||||
|
<div :class="icon" />
|
||||||
|
</slot>
|
||||||
|
<span>{{ text }}</span>
|
||||||
|
</div>
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
Loading…
Reference in a new issue