1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-07 09:29:59 +00:00

refactor: NavSideItem

This commit is contained in:
Anthony Fu 2022-11-27 10:35:26 +08:00
parent 3cd8fb54dd
commit cd4658506d
4 changed files with 37 additions and 78 deletions

View file

@ -4,12 +4,14 @@ import type { Account } from 'masto'
defineProps<{
account: Account
}>()
defineOptions({
inheritAttrs: false,
})
</script>
<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>

View file

@ -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>

View file

@ -1,65 +1,21 @@
<script setup lang="ts">
</script>
<template>
<div px3 py4 flex="~ col gap2" text-lg>
<template v-if="currentUser">
<NuxtLink to="/home" 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: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>
<NavSideItem text="Home" to="/home" icon="i-ri:home-5-line" />
<NavSideItem text="Notifications" to="/notifications" icon="i-ri:notification-4-line" />
</template>
<NuxtLink to="/explore" 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:hashtag />
<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>
<NavSideItem text="Explore" to="/explore" icon="i-ri:hashtag" />
<NavSideItem text="Local" to="/public/local" icon="i-ri:group-2-line " />
<NavSideItem text="Federated" to="/public" icon="i-ri:earth-line" />
<template v-if="currentUser">
<NuxtLink to="/conversations" 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:at-line />
<span>Conversations</span>
</div>
</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">
<NavSideItem text="Conversations" to="/conversations" icon="i-ri:at-line" />
<NavSideItem text="Favourites" to="/favourites" icon="i-ri:heart-3-line" />
<NavSideItem text="Bookmarks" to="/bookmarks" icon="i-ri:bookmark-line " />
<NavSideItem text="Lists" :to="getAccountPath(currentUser.account)" icon="i-ri:list-check-2-line">
<template #icon>
<AccountAvatar :account="currentUser.account" h="1.2em" />
<span>Profile</span>
</div>
</NuxtLink>
</template>
</NavSideItem>
</template>
</div>
</template>

View 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>