Skip to content

Commit 1baec09

Browse files
authored
πŸ’„ Revamp tab bar
1 parent 50ab14a commit 1baec09

3 files changed

Lines changed: 66 additions & 38 deletions

File tree

β€Žcomponents/AppTabBar.vueβ€Ž

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,62 @@
11
<template>
2-
<nav class="bg-white dark:bg-theme-black border-t border-muted fixed bottom-0 left-0 right-0 pb-safe">
3-
<ul class="flex justify-around items-center w-full max-w-md min-h-14 mx-auto">
4-
<li
2+
<nav class="fixed inset-x-0 bottom-0 z-40 pb-safe pointer-events-none">
3+
<div
4+
:class="[
5+
'flex',
6+
'items-center',
7+
'justify-center',
8+
'gap-1',
9+
10+
'w-fit',
11+
'mx-auto',
12+
'mb-2',
13+
'p-1.5',
14+
15+
'bg-(--ui-bg)/80',
16+
'backdrop-blur-sm',
17+
'rounded-full',
18+
'ring-1 ring-(--ui-border)',
19+
'pointer-events-auto',
20+
]"
21+
>
22+
<template
523
v-for="item in menuItems"
6-
:key="item.label"
7-
class="flex-1"
24+
:key="item.key"
825
>
9-
<NuxtLink
26+
<UButton
1027
v-if="item.key === 'account' && hasLoggedIn"
11-
class="relative flex justify-center items-center"
28+
class="justify-center min-w-24 h-14 rounded-full"
29+
:variant="item.isActive ? 'solid' : 'ghost'"
30+
color="neutral"
1231
:to="item.to"
32+
size="xl"
33+
:aria-label="item.label"
1334
>
14-
<UAvatar
15-
:class="[
16-
'bg-white',
17-
item.isActive
18-
? 'border-2 border-theme-black dark:border-theme-white'
19-
: 'border border-muted',
20-
]"
21-
:src="user?.avatar"
22-
:alt="user?.displayName"
23-
icon="i-material-symbols-person-2-rounded"
24-
size="lg"
25-
/>
26-
<UserAvatarPlusBadge
27-
v-if="user?.isLikerPlus"
28-
:is-inverted="item.isActive"
29-
/>
30-
</NuxtLink>
35+
<template #leading>
36+
<div class="relative">
37+
<UAvatar
38+
class="bg-white ring-1 ring-default border border-default"
39+
:src="user?.avatar"
40+
:alt="user?.displayName"
41+
icon="i-material-symbols-person-2-rounded"
42+
size="md"
43+
/>
44+
<UserAvatarPlusBadge
45+
v-if="user?.isLikerPlus"
46+
:color="item.isActive ? 'secondary' : 'primary'"
47+
/>
48+
</div>
49+
</template>
50+
</UButton>
3151
<UButton
3252
v-else
33-
class="flex-col gap-0"
53+
class="flex-col gap-0 min-w-24 rounded-full"
3454
:label="item.label"
3555
:icon="item.icon"
36-
:color="item.isActive ? 'primary' : 'neutral'"
37-
variant="link"
56+
:variant="item.isActive ? 'solid' : 'ghost'"
57+
color="neutral"
3858
:to="item.to"
3959
size="xl"
40-
block
4160
:ui="{ label: 'text-xs' }"
4261
>
4362
<template
@@ -50,8 +69,8 @@
5069
/>
5170
</template>
5271
</UButton>
53-
</li>
54-
</ul>
72+
</template>
73+
</div>
5574
</nav>
5675
</template>
5776

β€Žcomponents/UserAvatarPlusBadge.vueβ€Ž

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@
55
verticalAlign === 'top' ? 'top-0 -translate-y-1/2' : 'bottom-0 translate-y-1/2',
66
]"
77
size="xs"
8-
:variant="isInverted ? 'solid' : 'outline'"
8+
variant="outline"
99
:ui="{
1010
base: [
1111
'rounded-full',
12-
isInverted
13-
? 'bg-theme-black dark:bg-theme-cyan text-theme-cyan dark:text-theme-black'
14-
: 'bg-theme-white dark:bg-theme-black',
12+
colorClass,
1513
'font-bold',
1614
],
1715
}"
@@ -21,11 +19,22 @@
2119
</template>
2220

2321
<script setup lang="ts">
24-
withDefaults(defineProps<{
25-
isInverted?: boolean
22+
const props = withDefaults(defineProps<{
23+
color?: 'primary' | 'secondary' | 'neutral'
2624
verticalAlign?: 'top' | 'bottom'
2725
}>(), {
28-
isInverted: false,
26+
color: 'primary',
2927
verticalAlign: 'bottom',
3028
})
29+
30+
const colorClass = computed(() => {
31+
switch (props.color) {
32+
case 'secondary':
33+
return 'bg-theme-cyan text-theme-black ring-theme-black'
34+
case 'neutral':
35+
return 'bg-theme-white dark:bg-theme-black'
36+
default:
37+
return 'bg-theme-black text-theme-cyan'
38+
}
39+
})
3140
</script>

β€Žpages/account/index.vueβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<UserAvatarPlusBadge
1616
v-if="user?.isLikerPlus"
1717
vertical-align="top"
18-
:is-inverted="true"
18+
color="primary"
1919
/>
2020
<div class="absolute -bottom-1 -right-1 rounded-full bg-(--app-bg)">
2121
<UButton

0 commit comments

Comments
Β (0)