updated and tested dashboard page
This commit is contained in:
188
example_components/content/content.html
Normal file
188
example_components/content/content.html
Normal file
@@ -0,0 +1,188 @@
|
||||
<!-- Content -->
|
||||
<div class="p-6">
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-6">
|
||||
<div class="bg-white rounded-md border border-gray-100 p-6 shadow-md shadow-black/5">
|
||||
<div class="flex justify-between mb-6">
|
||||
<div>
|
||||
<div class="flex items-center mb-1">
|
||||
<div class="text-2xl font-semibold">2</div>
|
||||
</div>
|
||||
<div class="text-sm font-medium text-gray-400">Users</div>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="dropdown-toggle text-gray-400 hover:text-gray-600"><i class="ri-more-fill"></i></button>
|
||||
<ul class="dropdown-menu shadow-md shadow-black/5 z-30 hidden py-1.5 rounded-md bg-white border border-gray-100 w-full max-w-[140px]">
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Settings</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/gebruikers" class="text-[#f84525] font-medium text-sm hover:text-red-800">View</a>
|
||||
</div>
|
||||
<div class="bg-white rounded-md border border-gray-100 p-6 shadow-md shadow-black/5">
|
||||
<div class="flex justify-between mb-4">
|
||||
<div>
|
||||
<div class="flex items-center mb-1">
|
||||
<div class="text-2xl font-semibold">100</div>
|
||||
<div class="p-1 rounded bg-emerald-500/10 text-emerald-500 text-[12px] font-semibold leading-none ml-2">+30%</div>
|
||||
</div>
|
||||
<div class="text-sm font-medium text-gray-400">Companies</div>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="dropdown-toggle text-gray-400 hover:text-gray-600"><i class="ri-more-fill"></i></button>
|
||||
<ul class="dropdown-menu shadow-md shadow-black/5 z-30 hidden py-1.5 rounded-md bg-white border border-gray-100 w-full max-w-[140px]">
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Settings</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<a href="/dierenartsen" class="text-[#f84525] font-medium text-sm hover:text-red-800">View</a>
|
||||
</div>
|
||||
<div class="bg-white rounded-md border border-gray-100 p-6 shadow-md shadow-black/5">
|
||||
<div class="flex justify-between mb-6">
|
||||
<div>
|
||||
<div class="text-2xl font-semibold mb-1">100</div>
|
||||
<div class="text-sm font-medium text-gray-400">Blogs</div>
|
||||
</div>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="dropdown-toggle text-gray-400 hover:text-gray-600"><i class="ri-more-fill"></i></button>
|
||||
<ul class="dropdown-menu shadow-md shadow-black/5 z-30 hidden py-1.5 rounded-md bg-white border border-gray-100 w-full max-w-[140px]">
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Settings</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<a href="" class="text-[#f84525] font-medium text-sm hover:text-red-800">View</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tables section -->
|
||||
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-6">
|
||||
<!-- Users table -->
|
||||
<div class="p-6 relative flex flex-col min-w-0 mb-4 lg:mb-0 break-words bg-gray-50 dark:bg-gray-800 w-full shadow-lg rounded">
|
||||
<div class="rounded-t mb-0 px-0 border-0">
|
||||
<div class="flex flex-wrap items-center px-4 py-2">
|
||||
<div class="relative w-full max-w-full flex-grow flex-1">
|
||||
<h3 class="font-semibold text-base text-gray-900 dark:text-gray-50">Users</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block w-full overflow-x-auto">
|
||||
<table class="items-center w-full bg-transparent border-collapse">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-4 bg-gray-100 dark:bg-gray-600 text-gray-500 dark:text-gray-100 align-middle border border-solid border-gray-200 dark:border-gray-500 py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left">Role</th>
|
||||
<th class="px-4 bg-gray-100 dark:bg-gray-600 text-gray-500 dark:text-gray-100 align-middle border border-solid border-gray-200 dark:border-gray-500 py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left">Amount</th>
|
||||
<th class="px-4 bg-gray-100 dark:bg-gray-600 text-gray-500 dark:text-gray-100 align-middle border border-solid border-gray-200 dark:border-gray-500 py-3 text-xs uppercase border-l-0 border-r-0 whitespace-nowrap font-semibold text-left min-w-140-px"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="text-gray-700 dark:text-gray-100">
|
||||
<th class="border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left">Administrator</th>
|
||||
<td class="border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4">1</td>
|
||||
<td class="border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4">
|
||||
<div class="flex items-center">
|
||||
<span class="mr-2">70%</span>
|
||||
<div class="relative w-full">
|
||||
<div class="overflow-hidden h-2 text-xs flex rounded bg-blue-200">
|
||||
<div style="width: 70%" class="shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-600"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-gray-700 dark:text-gray-100">
|
||||
<th class="border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4 text-left">User</th>
|
||||
<td class="border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4">6</td>
|
||||
<td class="border-t-0 px-4 align-middle border-l-0 border-r-0 text-xs whitespace-nowrap p-4">
|
||||
<div class="flex items-center">
|
||||
<span class="mr-2">40%</span>
|
||||
<div class="relative w-full">
|
||||
<div class="overflow-hidden h-2 text-xs flex rounded bg-blue-200">
|
||||
<div style="width: 40%" class="shadow-none flex flex-col text-center whitespace-nowrap text-white justify-center bg-blue-500"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Activities table -->
|
||||
<div class="bg-white border border-gray-100 shadow-md shadow-black/5 p-6 rounded-md">
|
||||
<div class="flex justify-between mb-4 items-start">
|
||||
<div class="font-medium">Activities</div>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="dropdown-toggle text-gray-400 hover:text-gray-600"><i class="ri-more-fill"></i></button>
|
||||
<ul class="dropdown-menu shadow-md shadow-black/5 z-30 hidden py-1.5 rounded-md bg-white border border-gray-100 w-full max-w-[140px]">
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Settings</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="overflow-hidden">
|
||||
<table class="w-full min-w-[540px]">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="py-2 px-4 border-b border-b-gray-50">
|
||||
<div class="flex items-center">
|
||||
<a href="#" class="text-gray-600 text-sm font-medium hover:text-blue-500 ml-2 truncate">Lorem Ipsum</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-2 px-4 border-b border-b-gray-50">
|
||||
<span class="text-[13px] font-medium text-gray-400">02-02-2024</span>
|
||||
</td>
|
||||
<td class="py-2 px-4 border-b border-b-gray-50">
|
||||
<span class="inline-block p-1 rounded bg-emerald-500/10 text-emerald-500 font-medium text-[12px] leading-none">Completed</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="py-2 px-4 border-b border-b-gray-50">
|
||||
<div class="flex items-center">
|
||||
<a href="#" class="text-gray-600 text-sm font-medium hover:text-blue-500 ml-2 truncate">Lorem Ipsum</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="py-2 px-4 border-b border-b-gray-50">
|
||||
<span class="text-[13px] font-medium text-gray-400">02-02-2024</span>
|
||||
</td>
|
||||
<td class="py-2 px-4 border-b border-b-gray-50">
|
||||
<span class="inline-block p-1 rounded bg-rose-500/10 text-rose-500 font-medium text-[12px] leading-none">Cancelled</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- End Content -->
|
||||
60
example_components/index.html
Normal file
60
example_components/index.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
<link href='https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css' rel='stylesheet'>
|
||||
<link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
|
||||
<title>Admin Panel</title>
|
||||
|
||||
<!-- Include the stylesheets -->
|
||||
<link rel="stylesheet" href="styles/main.css">
|
||||
</head>
|
||||
<body class="text-gray-800 font-inter">
|
||||
<!-- Include the sidebar component -->
|
||||
<div id="sidebar-container"></div>
|
||||
<script>
|
||||
fetch('sidebar/sidebar.html')
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.getElementById('sidebar-container').innerHTML = html;
|
||||
});
|
||||
</script>
|
||||
|
||||
<main class="w-full md:w-[calc(100%-256px)] md:ml-64 bg-gray-200 min-h-screen transition-all main">
|
||||
<!-- Include the navbar component -->
|
||||
<div id="navbar-container"></div>
|
||||
<script>
|
||||
fetch('navbar/navbar.html')
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.getElementById('navbar-container').innerHTML = html;
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Include the content component -->
|
||||
<div id="content-container"></div>
|
||||
<script>
|
||||
fetch('content/content.html')
|
||||
.then(response => response.text())
|
||||
.then(html => {
|
||||
document.getElementById('content-container').innerHTML = html;
|
||||
});
|
||||
</script>
|
||||
</main>
|
||||
|
||||
<script src="https://unpkg.com/@popperjs/core@2"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
||||
|
||||
<!-- Include the JavaScript files -->
|
||||
<script src="scripts/sidebar.js"></script>
|
||||
<script src="scripts/popper.js"></script>
|
||||
<script src="scripts/tabs.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
94
example_components/navbar/navbar.html
Normal file
94
example_components/navbar/navbar.html
Normal file
@@ -0,0 +1,94 @@
|
||||
<!-- navbar -->
|
||||
<div class="py-2 px-6 bg-[#f8f4f3] flex items-center shadow-md shadow-black/5 sticky top-0 left-0 z-30">
|
||||
<button type="button" class="text-lg text-gray-900 font-semibold sidebar-toggle">
|
||||
<i class="ri-menu-line"></i>
|
||||
</button>
|
||||
|
||||
<ul class="ml-auto flex items-center">
|
||||
<li class="mr-1 dropdown">
|
||||
<button type="button" class="dropdown-toggle text-gray-400 mr-4 w-8 h-8 rounded flex items-center justify-center hover:text-gray-600">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="hover:bg-gray-100 rounded-full" viewBox="0 0 24 24" style="fill: gray;transform: ;msFilter:;"><path d="M19.023 16.977a35.13 35.13 0 0 1-1.367-1.384c-.372-.378-.596-.653-.596-.653l-2.8-1.337A6.962 6.962 0 0 0 16 9c0-3.859-3.14-7-7-7S2 5.141 2 9s3.14 7 7 7c1.763 0 3.37-.66 4.603-1.739l1.337 2.8s.275.224.653.596c.387.363.896.854 1.384 1.367l1.358 1.392.604.646 2.121-2.121-.646-.604c-.379-.372-.885-.866-1.391-1.36zM9 14c-2.757 0-5-2.243-5-5s2.243-5 5-5 5 2.243 5 5-2.243 5-5 5z"></path></svg>
|
||||
</button>
|
||||
<div class="dropdown-menu shadow-md shadow-black/5 z-30 hidden max-w-xs w-full bg-white rounded-md border border-gray-100">
|
||||
<form action="" class="p-4 border-b border-b-gray-100">
|
||||
<div class="relative w-full">
|
||||
<input type="text" class="py-2 pr-4 pl-10 bg-gray-50 w-full outline-none border border-gray-100 rounded-md text-sm focus:border-blue-500" placeholder="Search...">
|
||||
<i class="ri-search-line absolute top-1/2 left-4 -translate-y-1/2 text-gray-900"></i>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<button type="button" class="dropdown-toggle text-gray-400 mr-4 w-8 h-8 rounded flex items-center justify-center hover:text-gray-600">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="hover:bg-gray-100 rounded-full" viewBox="0 0 24 24" style="fill: gray;transform: ;msFilter:;"><path d="M19 13.586V10c0-3.217-2.185-5.927-5.145-6.742C13.562 2.52 12.846 2 12 2s-1.562.52-1.855 1.258C7.185 4.074 5 6.783 5 10v3.586l-1.707 1.707A.996.996 0 0 0 3 16v2a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1v-2a.996.996 0 0 0-.293-.707L19 13.586zM19 17H5v-.586l1.707-1.707A.996.996 0 0 0 7 14v-4c0-2.757 2.243-5 5-5s5 2.243 5 5v4c0 .266.105.52.293.707L19 16.414V17zm-7 5a2.98 2.98 0 0 0 2.818-2H9.182A2.98 2.98 0 0 0 12 22z"></path></svg>
|
||||
</button>
|
||||
<div class="dropdown-menu shadow-md shadow-black/5 z-30 hidden max-w-xs w-full bg-white rounded-md border border-gray-100">
|
||||
<div class="flex items-center px-4 pt-4 border-b border-b-gray-100 notification-tab">
|
||||
<button type="button" data-tab="notification" data-tab-page="notifications" class="text-gray-400 font-medium text-[13px] hover:text-gray-600 border-b-2 border-b-transparent mr-4 pb-1 active">Notifications</button>
|
||||
<button type="button" data-tab="notification" data-tab-page="messages" class="text-gray-400 font-medium text-[13px] hover:text-gray-600 border-b-2 border-b-transparent mr-4 pb-1">Messages</button>
|
||||
</div>
|
||||
<div class="my-2">
|
||||
<ul class="max-h-64 overflow-y-auto" data-tab-for="notification" data-page="notifications">
|
||||
<li>
|
||||
<a href="#" class="py-2 px-4 flex items-center hover:bg-gray-50 group">
|
||||
<img src="https://placehold.co/32x32" alt="" class="w-8 h-8 rounded block object-cover align-middle">
|
||||
<div class="ml-2">
|
||||
<div class="text-[13px] text-gray-600 font-medium truncate group-hover:text-blue-500">New order</div>
|
||||
<div class="text-[11px] text-gray-400">from a user</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="py-2 px-4 flex items-center hover:bg-gray-50 group">
|
||||
<img src="https://placehold.co/32x32" alt="" class="w-8 h-8 rounded block object-cover align-middle">
|
||||
<div class="ml-2">
|
||||
<div class="text-[13px] text-gray-600 font-medium truncate group-hover:text-blue-500">New order</div>
|
||||
<div class="text-[11px] text-gray-400">from a user</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="max-h-64 overflow-y-auto hidden" data-tab-for="notification" data-page="messages">
|
||||
<li>
|
||||
<a href="#" class="py-2 px-4 flex items-center hover:bg-gray-50 group">
|
||||
<img src="https://placehold.co/32x32" alt="" class="w-8 h-8 rounded block object-cover align-middle">
|
||||
<div class="ml-2">
|
||||
<div class="text-[13px] text-gray-600 font-medium truncate group-hover:text-blue-500">John Doe</div>
|
||||
<div class="text-[11px] text-gray-400">Hello there!</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="py-2 px-4 flex items-center hover:bg-gray-50 group">
|
||||
<img src="https://placehold.co/32x32" alt="" class="w-8 h-8 rounded block object-cover align-middle">
|
||||
<div class="ml-2">
|
||||
<div class="text-[13px] text-gray-600 font-medium truncate group-hover:text-blue-500">Jane Doe</div>
|
||||
<div class="text-[11px] text-gray-400">Hi! How are you?</div>
|
||||
</div>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<button type="button" class="dropdown-toggle flex items-center gap-2">
|
||||
<img src="https://placehold.co/32x32" alt="" class="w-8 h-8 rounded block object-cover align-middle">
|
||||
<span class="text-sm font-medium text-gray-600">John Doe</span>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-4 h-4 text-gray-400" viewBox="0 0 24 24" style="fill: currentColor;transform: ;msFilter:;"><path d="M16.293 9.293 12 13.586 7.707 9.293l-1.414 1.414L12 16.414l5.707-5.707z"></path></svg>
|
||||
</button>
|
||||
<ul class="dropdown-menu shadow-md shadow-black/5 z-30 hidden py-1.5 rounded-md bg-white border border-gray-100 w-full max-w-[140px]">
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Profile</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Settings</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="#" class="flex items-center text-[13px] py-1.5 px-4 text-gray-600 hover:text-blue-500 hover:bg-gray-50">Logout</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- end navbar -->
|
||||
88
example_components/scripts/popper.js
Normal file
88
example_components/scripts/popper.js
Normal file
@@ -0,0 +1,88 @@
|
||||
// Popper functionality for dropdowns
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// start: Popper
|
||||
const popperInstance = {};
|
||||
document.querySelectorAll('.dropdown').forEach(function (item, index) {
|
||||
const popperId = 'popper-' + index;
|
||||
const toggle = item.querySelector('.dropdown-toggle');
|
||||
const menu = item.querySelector('.dropdown-menu');
|
||||
|
||||
if (toggle && menu) {
|
||||
menu.dataset.popperId = popperId;
|
||||
popperInstance[popperId] = Popper.createPopper(toggle, menu, {
|
||||
modifiers: [
|
||||
{
|
||||
name: 'offset',
|
||||
options: {
|
||||
offset: [0, 8],
|
||||
},
|
||||
},
|
||||
{
|
||||
name: 'preventOverflow',
|
||||
options: {
|
||||
padding: 24,
|
||||
},
|
||||
},
|
||||
],
|
||||
placement: 'bottom-end'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('click', function (e) {
|
||||
const toggle = e.target.closest('.dropdown-toggle');
|
||||
const menu = e.target.closest('.dropdown-menu');
|
||||
|
||||
if (toggle) {
|
||||
const menuEl = toggle.closest('.dropdown').querySelector('.dropdown-menu');
|
||||
const popperId = menuEl.dataset.popperId;
|
||||
|
||||
if (menuEl.classList.contains('hidden')) {
|
||||
hideDropdown();
|
||||
menuEl.classList.remove('hidden');
|
||||
showPopper(popperId);
|
||||
} else {
|
||||
menuEl.classList.add('hidden');
|
||||
hidePopper(popperId);
|
||||
}
|
||||
} else if (!menu) {
|
||||
hideDropdown();
|
||||
}
|
||||
});
|
||||
|
||||
function hideDropdown() {
|
||||
document.querySelectorAll('.dropdown-menu').forEach(function (item) {
|
||||
item.classList.add('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
function showPopper(popperId) {
|
||||
if (popperInstance[popperId]) {
|
||||
popperInstance[popperId].setOptions(function (options) {
|
||||
return {
|
||||
...options,
|
||||
modifiers: [
|
||||
...options.modifiers,
|
||||
{ name: 'eventListeners', enabled: true },
|
||||
],
|
||||
}
|
||||
});
|
||||
popperInstance[popperId].update();
|
||||
}
|
||||
}
|
||||
|
||||
function hidePopper(popperId) {
|
||||
if (popperInstance[popperId]) {
|
||||
popperInstance[popperId].setOptions(function (options) {
|
||||
return {
|
||||
...options,
|
||||
modifiers: [
|
||||
...options.modifiers,
|
||||
{ name: 'eventListeners', enabled: false },
|
||||
],
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// end: Popper
|
||||
});
|
||||
42
example_components/scripts/sidebar.js
Normal file
42
example_components/scripts/sidebar.js
Normal file
@@ -0,0 +1,42 @@
|
||||
// Sidebar functionality
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// start: Sidebar
|
||||
const sidebarToggle = document.querySelector('.sidebar-toggle');
|
||||
const sidebarOverlay = document.querySelector('.sidebar-overlay');
|
||||
const sidebarMenu = document.querySelector('.sidebar-menu');
|
||||
const main = document.querySelector('.main');
|
||||
|
||||
if (sidebarToggle) {
|
||||
sidebarToggle.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
main.classList.toggle('active');
|
||||
sidebarOverlay.classList.toggle('hidden');
|
||||
sidebarMenu.classList.toggle('-translate-x-full');
|
||||
});
|
||||
}
|
||||
|
||||
if (sidebarOverlay) {
|
||||
sidebarOverlay.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
main.classList.add('active');
|
||||
sidebarOverlay.classList.add('hidden');
|
||||
sidebarMenu.classList.add('-translate-x-full');
|
||||
});
|
||||
}
|
||||
|
||||
document.querySelectorAll('.sidebar-dropdown-toggle').forEach(function (item) {
|
||||
item.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
const parent = item.closest('.group');
|
||||
if (parent.classList.contains('selected')) {
|
||||
parent.classList.remove('selected');
|
||||
} else {
|
||||
document.querySelectorAll('.sidebar-dropdown-toggle').forEach(function (i) {
|
||||
i.closest('.group').classList.remove('selected');
|
||||
});
|
||||
parent.classList.add('selected');
|
||||
}
|
||||
});
|
||||
});
|
||||
// end: Sidebar
|
||||
});
|
||||
29
example_components/scripts/tabs.js
Normal file
29
example_components/scripts/tabs.js
Normal file
@@ -0,0 +1,29 @@
|
||||
// Tab functionality for notifications and messages
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// start: Tab
|
||||
document.querySelectorAll('[data-tab]').forEach(function (item) {
|
||||
item.addEventListener('click', function (e) {
|
||||
e.preventDefault();
|
||||
const tab = item.dataset.tab;
|
||||
const page = item.dataset.tabPage;
|
||||
const target = document.querySelector('[data-tab-for="' + tab + '"][data-page="' + page + '"]');
|
||||
|
||||
// Remove active class from all tab buttons
|
||||
document.querySelectorAll('[data-tab="' + tab + '"]').forEach(function (i) {
|
||||
i.classList.remove('active');
|
||||
});
|
||||
|
||||
// Hide all tab content
|
||||
document.querySelectorAll('[data-tab-for="' + tab + '"]').forEach(function (i) {
|
||||
i.classList.add('hidden');
|
||||
});
|
||||
|
||||
// Add active class to clicked tab button and show its content
|
||||
item.classList.add('active');
|
||||
if (target) {
|
||||
target.classList.remove('hidden');
|
||||
}
|
||||
});
|
||||
});
|
||||
// end: Tab
|
||||
});
|
||||
75
example_components/sidebar/sidebar.html
Normal file
75
example_components/sidebar/sidebar.html
Normal file
@@ -0,0 +1,75 @@
|
||||
<!--sidenav -->
|
||||
<div class="fixed left-0 top-0 w-64 h-full bg-[#f8f4f3] p-4 z-50 sidebar-menu transition-transform">
|
||||
<a href="#" class="flex items-center pb-4 border-b border-b-gray-800">
|
||||
<h2 class="font-bold text-2xl">LOREM <span class="bg-[#f84525] text-white px-2 rounded-md">IPSUM</span></h2>
|
||||
</a>
|
||||
<ul class="mt-4">
|
||||
<span class="text-gray-400 font-bold">ADMIN</span>
|
||||
<li class="mb-1 group">
|
||||
<a href="" class="flex font-semibold items-center py-2 px-4 text-gray-900 hover:bg-gray-950 hover:text-gray-100 rounded-md group-[.active]:bg-gray-800 group-[.active]:text-white group-[.selected]:bg-gray-950 group-[.selected]:text-gray-100">
|
||||
<i class="ri-home-2-line mr-3 text-lg"></i>
|
||||
<span class="text-sm">Dashboard</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="mb-1 group">
|
||||
<a href="" class="flex font-semibold items-center py-2 px-4 text-gray-900 hover:bg-gray-950 hover:text-gray-100 rounded-md group-[.active]:bg-gray-800 group-[.active]:text-white group-[.selected]:bg-gray-950 group-[.selected]:text-gray-100 sidebar-dropdown-toggle">
|
||||
<i class='bx bx-user mr-3 text-lg'></i>
|
||||
<span class="text-sm">Users</span>
|
||||
<i class="ri-arrow-right-s-line ml-auto group-[.selected]:rotate-90"></i>
|
||||
</a>
|
||||
<ul class="pl-7 mt-2 hidden group-[.selected]:block">
|
||||
<li class="mb-4">
|
||||
<a href="" class="text-gray-900 text-sm flex items-center hover:text-[#f84525] before:contents-[''] before:w-1 before:h-1 before:rounded-full before:bg-gray-300 before:mr-3">All</a>
|
||||
</li>
|
||||
<li class="mb-4">
|
||||
<a href="" class="text-gray-900 text-sm flex items-center hover:text-[#f84525] before:contents-[''] before:w-1 before:h-1 before:rounded-full before:bg-gray-300 before:mr-3">Roles</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="mb-1 group">
|
||||
<a href="" class="flex font-semibold items-center py-2 px-4 text-gray-900 hover:bg-gray-950 hover:text-gray-100 rounded-md group-[.active]:bg-gray-800 group-[.active]:text-white group-[.selected]:bg-gray-950 group-[.selected]:text-gray-100">
|
||||
<i class='bx bx-list-ul mr-3 text-lg'></i>
|
||||
<span class="text-sm">Activities</span>
|
||||
</a>
|
||||
</li>
|
||||
<span class="text-gray-400 font-bold">BLOG</span>
|
||||
<li class="mb-1 group">
|
||||
<a href="" class="flex font-semibold items-center py-2 px-4 text-gray-900 hover:bg-gray-950 hover:text-gray-100 rounded-md group-[.active]:bg-gray-800 group-[.active]:text-white group-[.selected]:bg-gray-950 group-[.selected]:text-gray-100 sidebar-dropdown-toggle">
|
||||
<i class='bx bxl-blogger mr-3 text-lg' ></i>
|
||||
<span class="text-sm">Post</span>
|
||||
<i class="ri-arrow-right-s-line ml-auto group-[.selected]:rotate-90"></i>
|
||||
</a>
|
||||
<ul class="pl-7 mt-2 hidden group-[.selected]:block">
|
||||
<li class="mb-4">
|
||||
<a href="" class="text-gray-900 text-sm flex items-center hover:text-[#f84525] before:contents-[''] before:w-1 before:h-1 before:rounded-full before:bg-gray-300 before:mr-3">All</a>
|
||||
</li>
|
||||
<li class="mb-4">
|
||||
<a href="" class="text-gray-900 text-sm flex items-center hover:text-[#f84525] before:contents-[''] before:w-1 before:h-1 before:rounded-full before:bg-gray-300 before:mr-3">Categories</a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="mb-1 group">
|
||||
<a href="" class="flex font-semibold items-center py-2 px-4 text-gray-900 hover:bg-gray-950 hover:text-gray-100 rounded-md group-[.active]:bg-gray-800 group-[.active]:text-white group-[.selected]:bg-gray-950 group-[.selected]:text-gray-100">
|
||||
<i class='bx bx-archive mr-3 text-lg'></i>
|
||||
<span class="text-sm">Archive</span>
|
||||
</a>
|
||||
</li>
|
||||
<span class="text-gray-400 font-bold">PERSONAL</span>
|
||||
<li class="mb-1 group">
|
||||
<a href="" class="flex font-semibold items-center py-2 px-4 text-gray-900 hover:bg-gray-950 hover:text-gray-100 rounded-md group-[.active]:bg-gray-800 group-[.active]:text-white group-[.selected]:bg-gray-950 group-[.selected]:text-gray-100">
|
||||
<i class='bx bx-bell mr-3 text-lg' ></i>
|
||||
<span class="text-sm">Notifications</span>
|
||||
<span class=" md:block px-2 py-0.5 ml-auto text-xs font-medium tracking-wide text-red-600 bg-red-200 rounded-full">5</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="mb-1 group">
|
||||
<a href="" class="flex font-semibold items-center py-2 px-4 text-gray-900 hover:bg-gray-950 hover:text-gray-100 rounded-md group-[.active]:bg-gray-800 group-[.active]:text-white group-[.selected]:bg-gray-950 group-[.selected]:text-gray-100">
|
||||
<i class='bx bx-envelope mr-3 text-lg' ></i>
|
||||
<span class="text-sm">Messages</span>
|
||||
<span class=" md:block px-2 py-0.5 ml-auto text-xs font-medium tracking-wide text-green-600 bg-green-200 rounded-full">2 New</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="fixed top-0 left-0 w-full h-full bg-black/50 z-40 md:hidden sidebar-overlay"></div>
|
||||
<!-- end sidenav -->
|
||||
83
example_components/styles/main.css
Normal file
83
example_components/styles/main.css
Normal file
@@ -0,0 +1,83 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');
|
||||
|
||||
/* Base styles */
|
||||
body {
|
||||
font-family: 'Inter', sans-serif;
|
||||
}
|
||||
|
||||
/* Sidebar styles */
|
||||
.sidebar-menu {
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.sidebar-menu.-translate-x-full {
|
||||
transform: translateX(-100%);
|
||||
}
|
||||
|
||||
/* Dropdown styles */
|
||||
.dropdown-menu {
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
/* Active states */
|
||||
.active {
|
||||
border-bottom: 2px solid #f84525;
|
||||
color: #111827;
|
||||
}
|
||||
|
||||
/* Group selected states */
|
||||
.group.selected .group-[\.selected]\:rotate-90 {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.group.selected .group-[\.selected]\:block {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.group.selected .group-[\.selected]\:bg-gray-950 {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(3 7 18 / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.group.active .group-[\.active]\:text-white {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(255 255 255 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.group.selected .group-[\.selected]\:text-gray-100 {
|
||||
--tw-text-opacity: 1;
|
||||
color: rgb(243 244 246 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
/* Responsive styles */
|
||||
@media (min-width: 768px) {
|
||||
.md\:ml-64 {
|
||||
margin-left: 16rem;
|
||||
}
|
||||
|
||||
.md\:hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.md\:w-\[calc\(100\%-256px\)\] {
|
||||
width: calc(100% - 256px);
|
||||
}
|
||||
|
||||
.md\:grid-cols-2 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.lg\:col-span-2 {
|
||||
grid-column: span 2 / span 2;
|
||||
}
|
||||
|
||||
.lg\:grid-cols-2 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.lg\:grid-cols-3 {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user