refactoring style and animation

This commit is contained in:
Geriano
2022-07-29 23:20:43 +07:00
parent 792d6fcbc9
commit c771514e57
6 changed files with 196 additions and 136 deletions

View File

@@ -33,10 +33,10 @@ Echo.private(`App.Models.User.${user.id}`)
</style> </style>
<template> <template>
<div class="flex bg-gray-300 dark:bg-gray-900 font-sans"> <div class="flex bg-gray-300 dark:bg-gray-900 font-sans w-full h-full">
<Head :title="title" /> <Head :title="title" />
<div ref="sidebar" class="fixed sm:static top-0 left-0 flex-none flex flex-col h-screen transition-all ease-in-out duration-300 z-20" :class="`${themes().get('sidebar', 'bg-gray-700 text-gray-200 hover:bg-gray-800 hover:text-gray-100 transition-all ease-in-out duration-100').replace(/hover:(bg|text)-(.*?)-(\d+)/)} ${open ? 'w-full sm:w-60' : 'w-0'}`"> <div ref="sidebar" class="fixed sm:static top-0 left-0 flex-none flex flex-col h-full min-h-screen transition-all ease-in-out duration-300 z-20" :class="`${themes().get('sidebar', 'bg-gray-700 text-gray-200 hover:bg-gray-800 hover:text-gray-100 transition-all ease-in-out duration-100').replace(/hover:(bg|text)-(.*?)-(\d+)/)} ${open ? 'w-full sm:w-60' : 'w-0'}`">
<div v-if="open" class="sticky top-0 left-0 flex-none flex items-center justify-between w-full h-14 px-2" :class="themes().get('topbar', 'bg-cyan-500 text-gray-700 hover:bg-cyan-600 hover:text-gray-800 transition-all ease-in-out duration-150').replace(/hover:(bg|text)-(.*?)-(\d+)/, '')"> <div v-if="open" class="sticky top-0 left-0 flex-none flex items-center justify-between w-full h-14 px-2" :class="themes().get('topbar', 'bg-cyan-500 text-gray-700 hover:bg-cyan-600 hover:text-gray-800 transition-all ease-in-out duration-150').replace(/hover:(bg|text)-(.*?)-(\d+)/, '')">
<Toggler @toggle="open = ! open" class="sm:hidden" /> <Toggler @toggle="open = ! open" class="sm:hidden" />
@@ -50,14 +50,14 @@ Echo.private(`App.Models.User.${user.id}`)
<Sidebar v-if="open" /> <Sidebar v-if="open" />
</div> </div>
<div class="relative w-full h-screen overflow-auto"> <div class="relative w-full h-full min-h-screen max-h-screen overflow-auto">
<div class="sticky top-0 left-0 z-20 flex-none flex justify-between w-full h-14 px-2" :class="themes().get('topbar', 'bg-cyan-500 text-gray-700 hover:bg-cyan-600 hover:text-gray-800 transition-all ease-in-out duration-150').replace(/hover:(bg|text)-(.*?)-(\d+)/, '')"> <div class="sticky top-0 left-0 z-20 flex-none flex justify-between w-full h-14 px-2" :class="themes().get('topbar', 'bg-cyan-500 text-gray-700 hover:bg-cyan-600 hover:text-gray-800 transition-all ease-in-out duration-150').replace(/hover:(bg|text)-(.*?)-(\d+)/, '')">
<Toggler @toggle="open = ! open" /> <Toggler @toggle="open = ! open" />
<TopbarDropdown /> <TopbarDropdown />
</div> </div>
<main class="min-h-full p-6 h-full"> <main class="p-6">
<slot /> <slot />
</main> </main>
</div> </div>

View File

@@ -45,6 +45,11 @@ const self = getCurrentInstance()
</template> </template>
<template #tbody="{ data }"> <template #tbody="{ data }">
<transition-group
enterActiveClass="transition-all duration-100"
leaveActiveClass="transition-all duration-50"
enterFromClass="opacity-0 -scale-y-100"
leaveToClass="opacity-0 -scale-y-100">
<tr v-for="(activity, i) in data" :key="i" class="dark:hover:bg-gray-600 dark:border-gray-800 transition-all"> <tr v-for="(activity, i) in data" :key="i" class="dark:hover:bg-gray-600 dark:border-gray-800 transition-all">
<td class="px-2 py-1 border border-inherit text-center">{{ i + 1 }}</td> <td class="px-2 py-1 border border-inherit text-center">{{ i + 1 }}</td>
<td class="px-2 py-1 border border-inherit uppercase">{{ activity.name }}</td> <td class="px-2 py-1 border border-inherit uppercase">{{ activity.name }}</td>
@@ -54,6 +59,7 @@ const self = getCurrentInstance()
<td class="px-2 py-1 border border-inherit uppercase">{{ activity.platform }}</td> <td class="px-2 py-1 border border-inherit uppercase">{{ activity.platform }}</td>
<td class="px-2 py-1 border border-inherit uppercase">{{ new Date(activity.created_at).toLocaleString('id') }}</td> <td class="px-2 py-1 border border-inherit uppercase">{{ new Date(activity.created_at).toLocaleString('id') }}</td>
</tr> </tr>
</transition-group>
</template> </template>
</Builder> </Builder>
</template> </template>

View File

@@ -160,8 +160,20 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</Card> </Card>
</DashboardLayout> </DashboardLayout>
<transition name="fade"> <transition
<div v-if="open" class="fixed top-0 left-0 w-full h-screen flex sm:items-center justify-center bg-black bg-opacity-40 overflow-auto z-10"> enterActiveClass="transition-all duration-500"
leaveActiveClass="transition-all duration-500"
enterFromClass="opacity-0"
leaveToClass="opacity-0">
<div v-if="open || icon" class="fixed top-0 left-0 w-full h-screen bg-black bg-opacity-80 overflow-auto z-20 blur-3xl"></div>
</transition>
<transition
enterActiveClass="transition-all duration-150"
leaveActiveClass="transition-all duration-150"
enterFromClass="-translate-y-full opacity-0"
leaveToClass="-translate-y-full opacity-0">
<div v-if="open" class="fixed top-0 left-0 w-full h-screen flex justify-center z-20 p-10 overflow-auto">
<form @submit.prevent="submit" class="w-full max-w-xl sm:max-w-5xl rounded-md shadow-xl"> <form @submit.prevent="submit" class="w-full max-w-xl sm:max-w-5xl rounded-md shadow-xl">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100"> <Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100">
<template #header> <template #header>
@@ -272,18 +284,22 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</div> </div>
</transition> </transition>
<transition name="fade"> <transition
<div v-if="icon" class="fixed top-0 left-0 w-full h-screen flex sm:items-center justify-center bg-black bg-opacity-40 overflow-auto z-10"> enterActiveClass="transition-all duration-150"
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100 w-full max-w-xl sm:max-w-5xl"> leaveActiveClass="transition-all duration-150"
enterFromClass="-translate-y-full opacity-0"
leaveToClass="-translate-y-full opacity-0">
<div v-if="icon" class="fixed top-0 left-0 w-full h-screen flex justify-center overflow-auto z-20 p-10">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100 w-full max-w-xl sm:max-w-5xl max-h-96 overflow-auto">
<template #header> <template #header>
<div class="flex items-center space-x-2 p-2 justify-end bg-gray-200 dark:bg-gray-800"> <div class="flex items-center space-x-2 p-2 justify-end bg-gray-200 dark:bg-gray-800 sticky top-0 left-0">
<input type="search" v-model="search" class="py-1 w-full bg-white dark:bg-transparent rounded-md text-sm uppercase" placeholder="search something"> <input type="search" v-model="search" class="py-1 w-full bg-white dark:bg-transparent rounded-md text-sm uppercase" placeholder="search something">
<Icon @click.prevent="icon = false" name="times" class="px-2 py-1 bg-gray-300 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-md transition-all cursor-pointer" /> <Icon @click.prevent="icon = false" name="times" class="px-2 py-1 bg-gray-300 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 rounded-md transition-all cursor-pointer" />
</div> </div>
</template> </template>
<template #body> <template #body>
<div class="flex-wrap p-4 max-h-96 overflow-auto"> <div class="flex-wrap p-4">
<Icon v-for="(icx, i) in icons.filter(icx => icx.includes(search.trim().toLocaleLowerCase()))" :key="i" @click.prevent="form.icon = icx; icon = false" :name="icx" class="m-1 text-5xl px-2 py-1 text-gray-800 bg-gray-200 hover:bg-gray-100 dark:text-white dark:bg-gray-600 dark:hover:bg-gray-700 rounded-md cursor-pointer transition-all" /> <Icon v-for="(icx, i) in icons.filter(icx => icx.includes(search.trim().toLocaleLowerCase()))" :key="i" @click.prevent="form.icon = icx; icon = false" :name="icx" class="m-1 text-5xl px-2 py-1 text-gray-800 bg-gray-200 hover:bg-gray-100 dark:text-white dark:bg-gray-600 dark:hover:bg-gray-700 rounded-md cursor-pointer transition-all" />
</div> </div>
</template> </template>

View File

@@ -93,17 +93,6 @@ onMounted(() => {
onUnmounted(() => window.removeEventListener('keydown', esc)) onUnmounted(() => window.removeEventListener('keydown', esc))
</script> </script>
<style>
.opacity-enter-active, .opacity-leave-active {
transition: all 100ms ease-in-out;
opacity: 1;
}
.opacity-enter-from, .opacity-enter-to {
opacity: 0;
}
</style>
<template> <template>
<DashboardLayout title="Permission"> <DashboardLayout title="Permission">
<Card class="bg-gray-50 dark:bg-slate-700 shadow-md"> <Card class="bg-gray-50 dark:bg-slate-700 shadow-md">
@@ -119,14 +108,18 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</template> </template>
<template #body> <template #body>
<div class="flex flex-col"> <div class="flex flex-col space-y-2 p-4 h-screen max-h-96 overflow-auto">
<div class="flex items-center justify-end space-x-2 text-sm dark:text-gray-100 px-4 py-2"> <div class="flex items-center justify-end space-x-2 text-sm dark:text-gray-100 px-4">
<input v-model="search" type="search" class="bg-transparent w-full max-w-sm rounded-md placeholder:capitalize py-1" placeholder="search"> <input v-model="search" type="search" class="bg-transparent w-full max-w-sm rounded-md placeholder:capitalize py-1" placeholder="search">
</div> </div>
<div class="flex-wrap px-4 pb-2 dark:bg-gray-700 dark:text-gray-100 rounded-b-md"> <div class="flex-wrap px-4 pb-2 dark:bg-gray-700 dark:text-gray-100 rounded-b-md">
<transition-group name="opacity"> <transition-group
<div v-for="(permission, i) in permissions.filter(p => p.name?.toLowerCase().includes(search?.trim().toLowerCase()))" :key="i" class="inline-block bg-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-900 transition-all border dark:border-gray-700 dark:hover:border-gray-800 rounded-md m-[2px] px-3 py-1"> enterActiveClass="transition-all duration-300"
leaveActiveClass="transition-all duration-300"
enterFromClass="opacity-0 -translate-y-100"
leaveToClass="opacity-0 -translate-y-100">
<div v-for="(permission, i) in permissions.filter(p => p.name?.toLowerCase().includes(search?.trim().toLowerCase()))" :key="i" class="inline-block bg-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-900 transition-all duration-300 border dark:border-gray-700 dark:hover:border-gray-800 rounded-md m-[2px] px-3 py-1">
<div class="flex items-center space-x-2 text-sm"> <div class="flex items-center space-x-2 text-sm">
<p class="uppercase">{{ permission.name }}</p> <p class="uppercase">{{ permission.name }}</p>
@@ -143,8 +136,20 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</Card> </Card>
</DashboardLayout> </DashboardLayout>
<transition name="fade"> <transition
<div v-if="open" class="fixed top-0 left-0 w-full h-screen flex sm:items-center justify-center bg-black bg-opacity-40 overflow-auto z-10"> enterActiveClass="transition-all duration-500"
leaveActiveClass="transition-all duration-500"
enterFromClass="opacity-0"
leaveToClass="opacity-0">
<div v-if="open" class="fixed top-0 left-0 w-full h-screen bg-black bg-opacity-80 z-20 overflow-hidden blur-3xl"></div>
</transition>
<transition
enterActiveClass="transition-all duration-150"
leaveActiveClass="transition-all duration-150"
enterFromClass="-translate-y-full opacity-0"
leaveToClass="-translate-y-full opacity-0">
<div v-if="open" class="fixed top-0 left-0 w-full h-screen flex justify-center overflow-auto z-20 p-10">
<form @submit.prevent="submit" class="w-full max-w-xl shadow-xl"> <form @submit.prevent="submit" class="w-full max-w-xl shadow-xl">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100 border dark:border-gray-700"> <Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100 border dark:border-gray-700">
<template #header> <template #header>

View File

@@ -132,11 +132,13 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</template> </template>
<template v-slot:tbody="{ data, processing, empty, refresh }"> <template v-slot:tbody="{ data, processing, empty, refresh }">
<transition-group
enterActiveClass="transition-all duration-300"
leaveActiveClass="transition-all duration-100"
enterFromClass="opacity-0"
leaveToClass="opacity-0">
<template v-if="processing"> <template v-if="processing">
<tr v-for="i in Array(5).fill(0)" :key="i"> <tr v-for="i in Array(1).fill(0)" :key="i">
<td class="text-5xl text-center p-2" colspan="1000">
<div class="lowercase first-letter:capitalize font-semibold dark:bg-gray-800 animate-pulse p-5 rounded-md"></div>
</td>
</tr> </tr>
</template> </template>
@@ -180,6 +182,7 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
<p class="lowercase first-letter:capitalize font-semibold">there are no data available</p> <p class="lowercase first-letter:capitalize font-semibold">there are no data available</p>
</td> </td>
</tr> </tr>
</transition-group>
</template> </template>
</Builder> </Builder>
</div> </div>
@@ -187,8 +190,20 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</Card> </Card>
</DashboardLayout> </DashboardLayout>
<transition name="fade"> <transition
<div v-if="open" class="fixed top-0 left-0 w-full h-full bg-black bg-opacity-40 flex sm:items-center justify-center overflow-auto z-10"> enterActiveClass="transition-all duration-500"
leaveActiveClass="transition-all duration-500"
enterFromClass="opacity-0"
leaveToClass="opacity-0">
<div v-if="open" class="fixed top-0 left-0 w-full h-full bg-black bg-opacity-80 z-20 overflow-hidden blur-3xl"></div>
</transition>
<transition
enterActiveClass="transition-all duration-150"
leaveActiveClass="transition-all duration-150"
enterFromClass="-translate-y-full opacity-0"
leaveToClass="-translate-y-full opacity-0">
<div v-if="open" class="fixed top-0 left-0 w-full h-full flex justify-center overflow-auto z-20 p-10">
<form @submit.prevent="submit" class="w-full max-w-xl shadow-xl"> <form @submit.prevent="submit" class="w-full max-w-xl shadow-xl">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100"> <Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100">
<template #header> <template #header>

View File

@@ -171,8 +171,13 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</template> </template>
<template v-slot:tbody="{ data, processing, empty, refresh }"> <template v-slot:tbody="{ data, processing, empty, refresh }">
<transition-group
enterActiveClass="transition-all duration-100"
leaveActiveClass="transition-all duration-50"
enterFromClass="opacity-0 -scale-y-100"
leaveToClass="opacity-0 -scale-y-100">
<template v-if="processing"> <template v-if="processing">
<tr v-for="i in Array(5).fill(0)" :key="i"> <tr v-for="i in Array(5).fill(0)" :key="i" class="border dark:border-gray-800">
<td class="text-5xl text-center p-2" colspan="1000"> <td class="text-5xl text-center p-2" colspan="1000">
<div class="lowercase first-letter:capitalize font-semibold dark:bg-gray-800 animate-pulse p-5 rounded-md"></div> <div class="lowercase first-letter:capitalize font-semibold dark:bg-gray-800 animate-pulse p-5 rounded-md"></div>
</td> </td>
@@ -235,6 +240,7 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
<p class="lowercase first-letter:capitalize font-semibold">there are no data available</p> <p class="lowercase first-letter:capitalize font-semibold">there are no data available</p>
</td> </td>
</tr> </tr>
</transition-group>
</template> </template>
</Builder> </Builder>
</div> </div>
@@ -242,8 +248,20 @@ onUnmounted(() => window.removeEventListener('keydown', esc))
</Card> </Card>
</DashboardLayout> </DashboardLayout>
<transition name="fade"> <transition
<div v-if="open" class="fixed top-0 left-0 w-full h-full bg-black bg-opacity-40 flex sm:items-center justify-center overflow-auto z-10"> enterActiveClass="transition-all duration-500"
leaveActiveClass="transition-all duration-500"
enterFromClass="opacity-0"
leaveToClass="opacity-0">
<div v-if="open" class="fixed top-0 left-0 w-full h-full bg-black bg-opacity-80 z-20 overflow-hidden blur-3xl"></div>
</transition>
<transition
enterActiveClass="transition-all duration-150"
leaveActiveClass="transition-all duration-150"
enterFromClass="-translate-y-full opacity-0"
leaveToClass="-translate-y-full opacity-0">
<div v-if="open" class="fixed top-0 left-0 w-full h-full flex justify-center overflow-auto z-20 p-10">
<form @submit.prevent="submit" class="w-full max-w-xl sm:max-w-5xl shadow-xl"> <form @submit.prevent="submit" class="w-full max-w-xl sm:max-w-5xl shadow-xl">
<Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100"> <Card class="bg-gray-50 dark:bg-gray-700 dark:text-gray-100">
<template #header> <template #header>