feat: sidebar style

This commit is contained in:
Alisa | Side.one 2023-05-12 01:39:33 +08:00
parent bfa3936dbb
commit a5affa079a
3 changed files with 41 additions and 14 deletions

View File

@ -82,15 +82,17 @@ chainStore.$subscribe((m, s) => {
</div> </div>
</div> </div>
</div> </div>
<div> <div class="flex-1 w-0">
<div <div
class="capitalize text-base font-semibold text-gray-600 dark:text-gray-200" class="capitalize whitespace-nowrap text-base font-semibold text-gray-600 dark:text-gray-200"
> >
{{ {{
baseStore.latest.block?.header?.chain_id || chainStore.chainName || '' baseStore.latest.block?.header?.chain_id || chainStore.chainName || ''
}} }}
</div> </div>
<div class="text-xs text-gray-500 dark:text-gray-400"> <div
class="text-xs text-gray-500 dark:text-gray-400 whitespace-nowrap hidden lg:block"
>
{{ chainStore.connErr || chainStore.endpoint.address }} {{ chainStore.connErr || chainStore.endpoint.address }}
</div> </div>
</div> </div>

View File

@ -1,5 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { Icon } from '@iconify/vue'; import { Icon } from '@iconify/vue';
import { ref } from 'vue';
import { useThemeConfig } from '@/plugins/vuetify/@core/composable/useThemeConfig'; import { useThemeConfig } from '@/plugins/vuetify/@core/composable/useThemeConfig';
// Components // Components
@ -30,15 +31,21 @@ blockchain.$subscribe((m, s) => {
blockchain.initial(); blockchain.initial();
} }
}); });
const sidebarShow = ref(false);
</script> </script>
<template> <template>
<div class=""> <div class="">
<div class="w-64 fixed left-0 top-0 bottom-0 overflow-auto bg-base-100"> <!-- sidebar -->
<div
class="w-64 fixed z-50 left-0 top-0 bottom-0 overflow-auto bg-base-100 border-r border-gray-100 dark:border-gray-700"
:class="{ block: sidebarShow, 'hidden xl:block': !sidebarShow }"
>
<div class="flex items-center pl-4 py-4 mb-1"> <div class="flex items-center pl-4 py-4 mb-1">
<img class="w-10 h-10" src="../../assets/logo.svg" /> <img class="w-10 h-10" src="../../assets/logo.svg" />
<h1 class="flex-1 ml-3 text-2xl font-bold dark:text-white">Ping.pub</h1> <h1 class="flex-1 ml-3 text-2xl font-bold dark:text-white">Ping.pub</h1>
<div class="pr-4 cursor-pointer xl:hidden"> <div class="pr-4 cursor-pointer xl:hidden" @click="sidebarShow = false">
<Icon icon="mdi-close" class="text-3xl" /> <Icon icon="mdi-close" class="text-3xl" />
</div> </div>
</div> </div>
@ -63,7 +70,7 @@ blockchain.$subscribe((m, s) => {
/> />
<img <img
v-if="item?.icon?.image" v-if="item?.icon?.image"
v-lazy="item?.icon?.image" :src="item?.icon?.image"
class="w-6 h-6 rounded-full mr-3" class="w-6 h-6 rounded-full mr-3"
/> />
<div <div
@ -82,16 +89,28 @@ blockchain.$subscribe((m, s) => {
<div class="menu bg-base-100 w-full"> <div class="menu bg-base-100 w-full">
<RouterLink <RouterLink
v-for="(el, key) of item?.children" v-for="(el, key) of item?.children"
@click="sidebarShow = false"
:key="key" :key="key"
class="hover:bg-gray-100 dark:hover:bg-[#373f59] rounded cursor-pointer px-3 py-2 flex items-center" class="hover:bg-gray-100 dark:hover:bg-[#373f59] rounded cursor-pointer px-3 py-2 flex items-center"
:to="el?.to" :to="el?.to"
:class="{
'bg-primary':
$route.path === el?.to?.path && item?.title !== 'Favorite',
}"
> >
<img <img
v-if="el?.icon?.image" v-if="el?.icon?.image"
v-lazy="el?.icon?.image" :src="el?.icon?.image"
class="w-6 h-6 rounded-full mr-3" class="w-6 h-6 rounded-full mr-3"
/> />
<div class="text-base text-gray-500 dark:text-gray-300"> <div
class="text-base text-gray-500 dark:text-gray-300"
:class="{
'text-white':
$route.path === el?.to?.path &&
item?.title !== 'Favorite',
}"
>
{{ $t(el?.title) }} {{ $t(el?.title) }}
</div> </div>
</RouterLink> </RouterLink>
@ -102,6 +121,7 @@ blockchain.$subscribe((m, s) => {
<RouterLink <RouterLink
:to="item?.to" :to="item?.to"
v-if="item?.title && !item?.children?.length" v-if="item?.title && !item?.children?.length"
@click="sidebarShow = false"
class="collapse-title px-4 flex items-center py-2 hover:bg-gray-100 dark:hover:bg-[#373f59]" class="collapse-title px-4 flex items-center py-2 hover:bg-gray-100 dark:hover:bg-[#373f59]"
> >
<Icon <Icon
@ -115,7 +135,7 @@ blockchain.$subscribe((m, s) => {
/> />
<img <img
v-if="item?.icon?.image" v-if="item?.icon?.image"
v-lazy="item?.icon?.image" :src="item?.icon?.image"
class="w-6 h-6 rounded-full mr-3" class="w-6 h-6 rounded-full mr-3"
/> />
<div <div
@ -138,15 +158,21 @@ blockchain.$subscribe((m, s) => {
</div> </div>
</div> </div>
</div> </div>
<div class="ml-64 px-5"> <div class="xl:ml-64 px-5">
<div class="flex items-center py-3"> <!-- header -->
<div class="text-2xl pr-3 cursor-pointer xl:hidden"> <div
class="flex items-center py-3 bg-base-100 mb-4 rounded px-4 sticky top-0 z-10 mt-4 shadow"
>
<div
class="text-2xl pr-3 cursor-pointer xl:hidden"
@click="sidebarShow = true"
>
<Icon icon="mdi-menu" /> <Icon icon="mdi-menu" />
</div> </div>
<UserProfile /> <UserProfile />
<div class="flex-1"></div> <div class="flex-1 w-0"></div>
<!-- <NavSearchBar />--> <!-- <NavSearchBar />-->
<NavBarNotifications class="hidden md:inline-block" /> <NavBarNotifications class="hidden md:inline-block" />

View File

@ -8,7 +8,6 @@ module.exports = {
yes: '#3fb68b', yes: '#3fb68b',
no: '#ff5353', no: '#ff5353',
info: '#00b2ff', info: '#00b2ff',
primary: '#666cff',
main: 'var(--text-main)', main: 'var(--text-main)',
secondary: 'var(--text-secondary)', secondary: 'var(--text-secondary)',
active: 'var(--bg-active)', active: 'var(--bg-active)',