update scrollbar aside

This commit is contained in:
Dede Fuji Abdul 2023-10-18 11:09:01 +07:00
parent f98fb80d06
commit 36945917b0
3 changed files with 22 additions and 101 deletions

View File

@ -1,23 +1,25 @@
/* Firefox */
* {
scrollbar-width: 4px;
scrollbar-width: 6px;
scrollbar-color: var(--secondary) var(--primary);
}
/* Chrome, Edge, and Safari */
*::-webkit-scrollbar {
width: 4px;
::-webkit-scrollbar {
width: 6px;
}
*::-webkit-scrollbar-track {
background: var(--primary);
border-radius: 5px;
::-webkit-scrollbar-track {
border-radius: 6px;
}
*::-webkit-scrollbar-thumb {
background-color: var(--secondary);
border-radius: 14px;
border: 3px solid var(--primary);
::-webkit-scrollbar-thumb {
background: #cddee3;
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: #9abdc6;
}
* { -webkit-tap-highlight-color: rgba(0,0,0,0); }

View File

@ -1,14 +1,11 @@
<script setup lang="ts">
import { computed, watch } from 'vue'
import { watch } from 'vue'
import { useRoute } from 'vue-router'
import { RouterLink } from 'vue-router'
import { ref } from 'vue'
import {
Dialog,
DialogPanel,
Disclosure,
DisclosureButton,
DisclosurePanel,
TransitionChild,
TransitionRoot,
} from '@headlessui/vue'
@ -72,89 +69,12 @@ const closeSideBar = () => menu.toggleSidebar()
<div class="flex-1 h-0 mt-5 overflow-y-auto">
<nav class="px-2 space-y-1">
<template v-for="item in navigation" :key="item.name">
<div v-if="!item.children || item.children.length === 0">
<AsideMenuSingle :item="item" :selected="isMenu(item.href)" />
<!-- Single-level item -->
<!-- <RouterLink :to="item.href"
:class="[isMenu(item.href) ? 'bg-primary-500 text-white font-bold' : 'font-semibold text-aside hover:bg-primary-100 hover:text-gray-900', 'group w-full flex items-center pl-2 py-2 text-xs rounded-lg']">
<component :is="item.icon"
:class="[isMenu(item.href) ? 'text-white' : 'text-aside group-hover:text-gray-900', 'mr-3 flex-shrink-0 h-6 w-6']"
aria-hidden="true" />
{{ item.name }}
</RouterLink> -->
</div>
<Disclosure v-else
v-bind:default-open="item.children.find((d) => d.href === menu.menuSelected) || item.children.find((d) => d.children.find((e) => e.href === menu.menuSelected)) ? true : false">
<!-- Nested item with children -->
<template v-slot="{ open }">
<DisclosureButton
:class="[item.children.find((d) => d.href === menu.menuSelected) || item.children.find((d) => d.children.find((e) => e.href === menu.menuSelected)) ? 'text-primary-500 font-bold' : 'font-semibold text-aside hover:bg-primary-100 hover:text-gray-900', 'group w-full flex items-center pl-2 pr-1 py-2 text-left text-xs rounded-lg focus:outline-none focus:ring-0 focus:ring-indigo-500']">
<embed :data="item.icon"
:class="[item.children.find((d: any) => d.href === menu.menuSelected) || item.children.find((d) => d.children.find((e) => e.href === menu.menuSelected)) ? 'text-primary-500' : 'text-gray-400 group-hover:text-gray-500', 'flex-shrink-0 w-6 h-6 mr-3']"
type="image/svg+xml" />
<span class="flex-1">{{ item.name }}</span>
<svg :class="[item.children.find((d: any) => d.href === menu.menuSelected) || item.children.find((d) => d.children.find((e) => e.href === menu.menuSelected)) ? 'text-primary-500' : 'text-gray-300 group-hover:text-gray-500', open ? 'rotate-180' : '', 'ml-3 flex-shrink-0 transform transition-colors duration-150 ease-in-out ']"
width="16" height="16" viewBox="0 0 24 24" fill="none"
aria-hidden="true">
<path
d="M4.44002 8.9399C4.72127 8.659 5.10252 8.50122 5.50002 8.50122C5.89752 8.50122 6.27877 8.659 6.56002 8.9399L12 14.3799L17.44 8.9399C17.7244 8.67494 18.1005 8.53069 18.4891 8.53755C18.8777 8.54441 19.2484 8.70183 19.5233 8.97666C19.7981 9.25148 19.9555 9.62225 19.9624 10.0109C19.9692 10.3995 19.825 10.7756 19.56 11.0599L13.06 17.5599C12.7788 17.8408 12.3975 17.9986 12 17.9986C11.6025 17.9986 11.2213 17.8408 10.94 17.5599L4.44002 11.0599C4.15912 10.7787 4.00134 10.3974 4.00134 9.9999C4.00134 9.6024 4.15912 9.22115 4.44002 8.9399Z"
:fill="item.children.find((d: any) => d.href === menu.menuSelected) || item.children.find((d) => d.children.find((e) => e.href === menu.menuSelected)) ? '#14A2BA' : '#647375'" />
</svg>
</DisclosureButton>
<DisclosurePanel class="space-y-1">
<!-- Nested children -->
<template v-for="subItem in item.children" :key="subItem.name">
<div v-if="subItem.children.length === 0">
<!-- Single-level child -->
<!-- <RouterLink :to="subItem.href"
:class="[isMenu(subItem.href) ? 'text-white font-bold bg-primary-500' : 'font-semibold text-aside hover:bg-primary-100 hover:text-gray-900', 'flex items-center w-11/12 py-2 px-2 text-xs rounded-lg group ml-auto']">
{{ subItem.name }}
</RouterLink> -->
<AsideMenuSingle :item="subItem" :selected="isMenu(subItem.href)"
:is-children="true" />
</div>
<Disclosure v-else
:default-open="subItem.children.find((d: any) => d.href === menu.menuSelected) ? true : false">
<!-- Nested child with children -->
<template v-slot="{ open }">
<DisclosureButton
:class="[subItem.children.find((d: any) => d.href === menu.menuSelected) ? 'text-primary-500 font-bold' : 'font-semibold text-aside hover:bg-primary-100 hover:text-gray-900', 'group w-11/12 flex items-center px-2 py-2 text-left text-xs rounded-lg focus:outline-none focus:ring-0 focus:ring-indigo-500 ml-auto']">
<span class="flex-1">{{ subItem.name }}</span>
<svg :class="[subItem.children.find((d: any) => d.href === menu.menuSelected) ? 'text-primary-500' : 'text-gray-300 group-hover:text-gray-500', open ? 'rotate-180' : '', 'ml-3 flex-shrink-0 transform transition-colors duration-150 ease-in-out ']"
width="16" height="16" viewBox="0 0 24 24" fill="none"
aria-hidden="true">
<path
d="M4.44002 8.9399C4.72127 8.659 5.10252 8.50122 5.50002 8.50122C5.89752 8.50122 6.27877 8.659 6.56002 8.9399L12 14.3799L17.44 8.9399C17.7244 8.67494 18.1005 8.53069 18.4891 8.53755C18.8777 8.54441 19.2484 8.70183 19.5233 8.97666C19.7981 9.25148 19.9555 9.62225 19.9624 10.0109C19.9692 10.3995 19.825 10.7756 19.56 11.0599L13.06 17.5599C12.7788 17.8408 12.3975 17.9986 12 17.9986C11.6025 17.9986 11.2213 17.8408 10.94 17.5599L4.44002 11.0599C4.15912 10.7787 4.00134 10.3974 4.00134 9.9999C4.00134 9.6024 4.15912 9.22115 4.44002 8.9399Z"
:fill="subItem.children.find((d: any) => d.href === menu.menuSelected) ? '#14A2BA' : '#647375'" />
</svg>
</DisclosureButton>
<DisclosurePanel class="space-y-1 pl-11">
<!-- Nested children of nested child -->
<!-- <RouterLink v-for="nestedSubItem in subItem.children"
:key="nestedSubItem.name" :to="nestedSubItem.href"
:class="[isMenu(nestedSubItem.href) ? 'text-white font-bold bg-primary-500' : 'font-semibold text-aside hover:bg-primary-100 hover:text-gray-900', 'flex items-center w-12/12 py-2 px-2 text-xs rounded-lg group ml-auto']">
{{ nestedSubItem.name }}
</RouterLink> -->
<AsideMenuSingle v-for="nestedSubItem in subItem.children"
:key="nestedSubItem.name" :item="nestedSubItem"
:selected="isMenu(nestedSubItem.href)"
:is-children="true" />
</DisclosurePanel>
</template>
</Disclosure>
</template>
</DisclosurePanel>
</template>
</Disclosure>
<!-- Single-level item -->
<AsideMenuSingle v-if="item.children.length === 0" :item="item"
:selected="isMenu(item.href)" />
<!-- Nested item with children -->
<AsideMenuMultiple v-else :item="item" :selected="isMenu(item.href)" />
</template>
</nav>
</div>
@ -174,7 +94,7 @@ const closeSideBar = () => menu.toggleSidebar()
<img class="w-auto h-11" :src="IconApp" alt="PLN" />
</RouterLink>
</div>
<div class="flex flex-col flex-grow hover:overflow-y-auto">
<div class="flex flex-col flex-grow overflow-y-auto">
<div class="flex flex-col flex-grow mt-5">
<nav class="flex-1 px-2 pb-4 space-y-1">
<template v-for="item in navigation" :key="item.name">

View File

@ -59,10 +59,9 @@ const isMenuSelected = computed(() => {
<!-- Nested children -->
<template v-for="(subItem, index) in item.children" :key="subItem.href">
<!-- Single-level child -->
<div v-if="subItem.children.length === 0" :class="[isChildren ? '' : '']">
<AsideMenuSingle :item="subItem" :is-children="true" :selected="isMenu(subItem.href)" />
</div>
<AsideMenuSingle v-if="subItem.children.length === 0" :item="subItem" :is-children="true"
:selected="isMenu(subItem.href)" />
<!-- Multiple-level child -->
<AsideMenuMultiple v-else :item="subItem" :selected="subItem.href === menu.menuSelected"
:is-children="true" />
</template>