Skip to content

Commit 67c16c0

Browse files
committed
fix(stats): improve mobile layout
1 parent 269c12d commit 67c16c0

File tree

2 files changed

+46
-16
lines changed

2 files changed

+46
-16
lines changed

src/views/Private/Stats/Incomes/StatsIncomes.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<article class="flex max-h-[1280px] grow flex-col xl:py-12">
2+
<article class="flex max-h-[1280px] grow flex-col pb-12 xl:pt-12">
33
<div class="mx-auto mt-6 flex w-full max-w-5xl flex-row flex-wrap place-items-end gap-3">
44
<div class="mx-6 w-full max-w-xs lg:mx-8">
55
<!-- @vue-ignore -->

src/views/Private/Stats/StatsPage.vue

+45-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
<template>
22
<main class="flex flex-1 overflow-hidden">
3-
<Head>
4-
<title>{{ $t('stats.head.title') }}</title>
5-
</Head>
63
<div class="flex flex-1 flex-col overflow-y-auto xl:overflow-hidden">
74
<!-- Mobile navigation -->
85
<Menu as="nav" class="relative inline-block text-left xl:hidden">
96
<MenuButton
10-
class="group w-full border-b border-gray-200 bg-white px-3.5 py-2 text-left text-sm font-medium text-gray-700 hover:bg-gray-200">
11-
<span class="flex w-full items-center justify-between">
12-
<p class="min-w-0 text-lg font-medium text-gray-900">
13-
{{ tabs.find(({ active }) => active)?.label }}
14-
</p>
7+
class="group w-full border-b border-gray-200 bg-white px-6 py-4 text-gray-700 hover:bg-gray-200">
8+
<span class="flex w-full flex-row items-start justify-between">
9+
<SvgIcon
10+
aria-hidden="true"
11+
class="h-6 w-6 shrink-0 text-indigo-400"
12+
:path="activeTab?.icon"
13+
type="mdi" />
14+
<div class="mx-3 text-left text-sm">
15+
<p class="text-base font-medium text-gray-900">{{ activeTab?.label }}</p>
16+
<p class="mt-1 text-gray-500">{{ activeTab?.description }}</p>
17+
</div>
1518

1619
<SvgIcon
1720
aria-hidden="true"
18-
class="h-5 w-5 shrink-0 text-gray-400 group-hover:text-gray-500"
21+
class="ml-auto h-6 w-6 shrink-0 self-center text-gray-400 group-hover:text-gray-500"
1922
:path="mdiUnfoldMoreHorizontal"
2023
type="mdi" />
2124
</span>
@@ -30,16 +33,29 @@
3033
<MenuItems
3134
class="absolute inset-x-0 z-10 mt-1 origin-top divide-y divide-gray-200 rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-[5%] focus:outline-none">
3235
<div class="py-1">
33-
<MenuItem v-for="tab in tabs" :key="tab.label" v-slot="{ close }">
36+
<MenuItem
37+
v-for="tab in tabs.filter(({ active }) => !active)"
38+
:key="tab.label"
39+
v-slot="{ close }">
3440
<router-link
3541
:aria-current="tab.active ? 'page' : undefined"
3642
:class="[
3743
tab.active ? 'bg-gray-100 text-gray-900' : 'text-gray-700',
38-
'block px-4 py-2 text-sm',
44+
'flex px-6 py-2',
3945
]"
4046
:to="tab.to"
4147
@click.capture="close">
42-
{{ tab.label }}
48+
<SvgIcon
49+
aria-hidden="true"
50+
class="h-6 w-6 shrink-0 text-indigo-400"
51+
:path="tab.icon"
52+
type="mdi" />
53+
<div class="ml-3 overflow-hidden text-left text-sm">
54+
<p class="font-medium text-gray-900">{{ tab.label }}</p>
55+
<p class="mt-1 truncate text-gray-500">
56+
{{ tab.description }}
57+
</p>
58+
</div>
4359
</router-link>
4460
</MenuItem>
4561
</div>
@@ -64,7 +80,7 @@
6480
tab.active
6581
? 'bg-indigo-50 bg-opacity-[50%]'
6682
: 'hover:bg-indigo-50 hover:bg-opacity-[50%]',
67-
'flex border-b border-gray-200 p-6',
83+
'group flex border-b border-gray-200 p-6 pr-3',
6884
]"
6985
:to="tab.to">
7086
<SvgIcon
@@ -76,6 +92,14 @@
7692
<p class="font-medium text-gray-900">{{ tab.label }}</p>
7793
<p class="mt-1 text-gray-500">{{ tab.description }}</p>
7894
</div>
95+
<SvgIcon
96+
aria-hidden="true"
97+
:class="[
98+
'h-6 w-6 shrink-0 self-center text-gray-500 group-hover:text-gray-600 group-hover:!opacity-100',
99+
tab.active ? 'opacity-80' : 'opacity-0',
100+
]"
101+
:path="mdiChevronRight"
102+
type="mdi" />
79103
</router-link>
80104
</div>
81105
</nav>
@@ -93,8 +117,12 @@
93117
import { doesRouteBelongsTo } from '@/router/helpers';
94118
import { ROUTE_NAMES } from '@/router/names';
95119
import { Menu, MenuButton, MenuItem, MenuItems } from '@headlessui/vue';
96-
import { mdiCashMultiple, mdiHomeAnalytics, mdiUnfoldMoreHorizontal } from '@mdi/js';
97-
import { Head } from '@unhead/vue/components';
120+
import {
121+
mdiCashMultiple,
122+
mdiChevronRight,
123+
mdiHomeAnalytics,
124+
mdiUnfoldMoreHorizontal,
125+
} from '@mdi/js';
98126
import { computed } from 'vue';
99127
import { useI18n } from 'vue-i18n';
100128
import { useRoute } from 'vue-router';
@@ -121,4 +149,6 @@ const tabs = computed(() => [
121149
active: doesRouteBelongsTo(route, ROUTE_NAMES.STATS.ACTIVITY),
122150
},
123151
]);
152+
153+
const activeTab = computed(() => tabs.value.find((tab) => tab.active));
124154
</script>

0 commit comments

Comments
 (0)