feat: Add and configure mobile bottom navigation for the Filament admin panel.
This commit is contained in:
parent
35190d7614
commit
af4218e707
@ -14,8 +14,11 @@
|
||||
use Filament\Panel;
|
||||
use Filament\PanelProvider;
|
||||
use Filament\Support\Colors\Color;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Widgets\AccountWidget;
|
||||
use Filament\Widgets\FilamentInfoWidget;
|
||||
use Hammadzafar05\MobileBottomNav\MobileBottomNav;
|
||||
use Hammadzafar05\MobileBottomNav\MobileBottomNavItem;
|
||||
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
|
||||
use Illuminate\Cookie\Middleware\EncryptCookies;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
@ -88,6 +91,34 @@ public function panel(Panel $panel): Panel
|
||||
->navigationLabel('Log')
|
||||
->navigationUrl('/system/logs')
|
||||
->pollingTime(null),
|
||||
|
||||
MobileBottomNav::make()
|
||||
->items([
|
||||
MobileBottomNavItem::make('Dasbor')
|
||||
->icon(Heroicon::OutlinedHome)
|
||||
->activeIcon(Heroicon::Home)
|
||||
->url('/admin')
|
||||
->isActive(fn () => request()->is('admin')),
|
||||
|
||||
MobileBottomNavItem::make('Presensi')
|
||||
->icon(Heroicon::OutlinedCheckCircle)
|
||||
->activeIcon(Heroicon::CheckCircle)
|
||||
->url('/admin/learning/attendances')
|
||||
->isActive(fn () => request()->is('admin/learning/attendances')),
|
||||
|
||||
MobileBottomNavItem::make('Materi')
|
||||
->icon(Heroicon::OutlinedBookOpen)
|
||||
->activeIcon(Heroicon::BookOpen)
|
||||
->url('/admin/learning/materials')
|
||||
->isActive(fn () => request()->is('admin/learning/materials')),
|
||||
|
||||
MobileBottomNavItem::make('Tugas')
|
||||
->icon(Heroicon::OutlinedClipboardDocumentList)
|
||||
->activeIcon(Heroicon::ClipboardDocumentList)
|
||||
->url('/admin/learning/assignments')
|
||||
->isActive(fn () => request()->is('admin/learning/assignments')),
|
||||
])
|
||||
->moreButton(false),
|
||||
])
|
||||
->maxContentWidth('full')
|
||||
->defaultAvatarProvider(FacehashProvider::class)
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
"filament/filament": "^5.0",
|
||||
"filament/spatie-laravel-media-library-plugin": "^5.0",
|
||||
"filament/spatie-laravel-settings-plugin": "^5.0",
|
||||
"hammadzafar05/mobile-bottom-nav": "^1.0",
|
||||
"joaopaulolndev/filament-pdf-viewer": "^3.0",
|
||||
"laravel/framework": "^12.0",
|
||||
"laravel/tinker": "^2.10.1",
|
||||
|
||||
79
composer.lock
generated
79
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "8392d40ff038be5645719684849b3b88",
|
||||
"content-hash": "a1dbb9834deb9867961bae477b5e320b",
|
||||
"packages": [
|
||||
{
|
||||
"name": "achyutn/filament-log-viewer",
|
||||
@ -2433,6 +2433,83 @@
|
||||
],
|
||||
"time": "2025-08-22T14:27:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "hammadzafar05/mobile-bottom-nav",
|
||||
"version": "v1.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/hammadzafar05/mobile-bottom-nav.git",
|
||||
"reference": "740d2020f6dc7d6e2db466c221d11ee1d829feaa"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/hammadzafar05/mobile-bottom-nav/zipball/740d2020f6dc7d6e2db466c221d11ee1d829feaa",
|
||||
"reference": "740d2020f6dc7d6e2db466c221d11ee1d829feaa",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"filament/filament": "^4.0 || ^5.0",
|
||||
"php": "^8.2",
|
||||
"spatie/laravel-package-tools": "^1.15.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"larastan/larastan": "^3.0",
|
||||
"laravel/pint": "^1.0",
|
||||
"nunomaduro/collision": "^8.0",
|
||||
"orchestra/testbench": "^9.0|^10.0",
|
||||
"pestphp/pest": "^3.7|^4.0",
|
||||
"pestphp/pest-plugin-arch": "^3.0|^4.0",
|
||||
"pestphp/pest-plugin-laravel": "^3.0|^4.0",
|
||||
"pestphp/pest-plugin-livewire": "^3.0|^4.0",
|
||||
"rector/rector": "^2.0",
|
||||
"spatie/laravel-ray": "^1.26"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Hammadzafar05\\MobileBottomNav\\MobileBottomNavServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Hammadzafar05\\MobileBottomNav\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Hammad Zafar",
|
||||
"email": "hammadarain05@gmail.com",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A thumb-friendly mobile bottom navigation bar for Filament panels. It programmatically integrates with the Filament navigation registry to provide a seamless, ergonomic mobile experience with full support for dark mode and safe-area insets.",
|
||||
"homepage": "https://github.com/hammadzafar05/mobile-bottom-nav",
|
||||
"keywords": [
|
||||
"filament",
|
||||
"filament-plugin",
|
||||
"filamentphp",
|
||||
"hammadzafar05",
|
||||
"laravel",
|
||||
"mobile-bottom-nav"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/hammadzafar05/mobile-bottom-nav/issues",
|
||||
"source": "https://github.com/hammadzafar05/mobile-bottom-nav"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/hammadzafar05",
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-02-24T07:51:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "joaopaulolndev/filament-pdf-viewer",
|
||||
"version": "v3.0.3",
|
||||
|
||||
0
resources/views/vendor/mobile-bottom-nav/.gitkeep
vendored
Normal file
0
resources/views/vendor/mobile-bottom-nav/.gitkeep
vendored
Normal file
219
resources/views/vendor/mobile-bottom-nav/bottom-navigation.blade.php
vendored
Normal file
219
resources/views/vendor/mobile-bottom-nav/bottom-navigation.blade.php
vendored
Normal file
@ -0,0 +1,219 @@
|
||||
@php
|
||||
use function Filament\Support\generate_href_html;
|
||||
use function Filament\Support\generate_icon_html;
|
||||
use Filament\Support\Enums\IconSize;
|
||||
@endphp
|
||||
<style data-navigate-track>
|
||||
.fi-bottom-nav {
|
||||
position: fixed;
|
||||
bottom: 1.5rem;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
z-index: 50;
|
||||
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
|
||||
width: calc(100% - 2.5rem);
|
||||
max-width: 440px;
|
||||
height: 4.5rem;
|
||||
|
||||
padding: 0 0.75rem;
|
||||
padding-bottom: env(safe-area-inset-bottom, 0px);
|
||||
|
||||
border-radius: 1.75rem;
|
||||
|
||||
backdrop-filter: blur(20px) saturate(180%);
|
||||
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
||||
|
||||
background: rgba(255, 255, 255, 0.35);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
|
||||
box-shadow:
|
||||
0 15px 35px -5px rgba(0, 0, 0, 0.1),
|
||||
0 5px 15px -3px rgba(0, 0, 0, 0.05),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.5);
|
||||
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.dark .fi-bottom-nav {
|
||||
background: rgba(15, 23, 42, 0.45);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
|
||||
box-shadow:
|
||||
0 20px 40px -10px rgba(0, 0, 0, 0.5),
|
||||
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.fi-bottom-nav-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: 1;
|
||||
|
||||
gap: 0.35rem;
|
||||
padding: 0.5rem 0;
|
||||
|
||||
border: none;
|
||||
background: none;
|
||||
text-decoration: none;
|
||||
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
|
||||
color: var(--gray-500);
|
||||
|
||||
transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
}
|
||||
|
||||
.dark .fi-bottom-nav-item {
|
||||
color: var(--gray-400);
|
||||
}
|
||||
|
||||
.fi-bottom-nav-item.fi-active {
|
||||
color: var(--primary-600);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.fi-bottom-nav-item.fi-active::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 0.25rem;
|
||||
width: 1.25rem;
|
||||
height: 0.125rem;
|
||||
background: currentColor;
|
||||
border-radius: 1rem;
|
||||
box-shadow: 0 0 8px currentColor;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.dark .fi-bottom-nav-item.fi-active {
|
||||
color: var(--primary-400);
|
||||
}
|
||||
|
||||
.fi-bottom-nav-label {
|
||||
font-size: 0.65rem;
|
||||
line-height: 1;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
max-width: 100%;
|
||||
text-align: center;
|
||||
padding: 0 0.25rem;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.fi-bottom-nav-item.fi-active .fi-bottom-nav-label {
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.01em;
|
||||
}
|
||||
|
||||
.fi-bottom-nav-icon-wrapper {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.fi-bottom-nav-item.fi-active .fi-bottom-nav-icon-wrapper {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
.fi-bottom-nav-badge {
|
||||
position: absolute;
|
||||
top: -4px;
|
||||
right: -6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 1rem;
|
||||
height: 1rem;
|
||||
padding: 0 0.25rem;
|
||||
font-size: 0.625rem;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
border-radius: 9999px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.fi-bottom-nav-badge-dot {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: -2px;
|
||||
width: 0.5rem;
|
||||
height: 0.5rem;
|
||||
border-radius: 9999px;
|
||||
border: 2px solid white;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.dark .fi-bottom-nav-badge-dot {
|
||||
border-color: #1f2937;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.fi-bottom-nav {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.fi-main {
|
||||
padding-bottom: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1023px) {
|
||||
.fi-main {
|
||||
padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px)) !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<nav x-data="{}" x-show="! $store.sidebar.isOpen" x-transition:leave="transition ease-in duration-150"
|
||||
x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0" class="fi-bottom-nav"
|
||||
aria-label="Bottom navigation">
|
||||
@foreach ($items as $item)
|
||||
@php
|
||||
$isActive = $item->isActiveState();
|
||||
$icon = $isActive && $item->getActiveIcon() ? $item->getActiveIcon() : $item->getIcon();
|
||||
$badge = $item->getBadge();
|
||||
$badgeColor = $item->getBadgeColor() ?? 'primary';
|
||||
$badgeCssColor = is_string($badgeColor) ? "var(--{$badgeColor}-500)" : 'var(--primary-500)';
|
||||
@endphp
|
||||
|
||||
<a {{ generate_href_html($item->getUrl()) }} @class(['fi-bottom-nav-item', 'fi-active' => $isActive])
|
||||
@if ($isActive) aria-current="page" @endif>
|
||||
<span class="fi-bottom-nav-icon-wrapper">
|
||||
{{ generate_icon_html($icon, size: IconSize::Large) }}
|
||||
|
||||
@if ($badge !== null && $badge !== '')
|
||||
@if (is_numeric($badge))
|
||||
<span class="fi-bottom-nav-badge"
|
||||
style="background-color: {{ $badgeCssColor }}">{{ $badge }}</span>
|
||||
@else
|
||||
<span class="fi-bottom-nav-badge-dot" style="background-color: {{ $badgeCssColor }}"></span>
|
||||
@endif
|
||||
@endif
|
||||
</span>
|
||||
|
||||
<span class="fi-bottom-nav-label">{{ $item->getLabel() }}</span>
|
||||
</a>
|
||||
@endforeach
|
||||
|
||||
@if ($moreButtonEnabled)
|
||||
<button type="button" x-on:click="$store.sidebar.open()" class="fi-bottom-nav-item"
|
||||
aria-label="{{ $moreButtonLabel }}">
|
||||
<span class="fi-bottom-nav-icon-wrapper">
|
||||
{{ generate_icon_html('heroicon-o-bars-3', size: IconSize::Large) }}
|
||||
</span>
|
||||
|
||||
<span class="fi-bottom-nav-label">{{ $moreButtonLabel }}</span>
|
||||
</button>
|
||||
@endif
|
||||
</nav>
|
||||
Loading…
Reference in New Issue
Block a user