From db4088602b6f7ec8cd857c5a206241c5f761de0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrei=20Ioni=C8=9B=C4=83?= Date: Sat, 16 Nov 2024 20:05:35 +0000 Subject: [PATCH] wip --- app/Filament/Admin/Resources/MenuResource.php | 19 + app/Models/Page.php | 15 +- app/Providers/Filament/AdminPanelProvider.php | 16 + app/View/Components/NavigationItem.php | 19 +- app/View/Components/Site/Header.php | 22 +- composer.json | 1 + composer.lock | 76 ++- config/filament-menu-builder.php | 11 + .../0001_01_30_000010_create_menus_table.php | 54 ++ .../filament-menu-builder-styles.css | 529 ++++++++++++++++++ .../components/filament-menu-builder.js | 23 + .../components/navigation-item.blade.php | 8 +- .../views/components/site/header.blade.php | 10 +- 13 files changed, 773 insertions(+), 30 deletions(-) create mode 100644 app/Filament/Admin/Resources/MenuResource.php create mode 100644 config/filament-menu-builder.php create mode 100644 database/migrations/0001_01_30_000010_create_menus_table.php create mode 100644 public/css/datlechin/filament-menu-builder/filament-menu-builder-styles.css create mode 100644 public/js/datlechin/filament-menu-builder/components/filament-menu-builder.js diff --git a/app/Filament/Admin/Resources/MenuResource.php b/app/Filament/Admin/Resources/MenuResource.php new file mode 100644 index 0000000..0098e11 --- /dev/null +++ b/app/Filament/Admin/Resources/MenuResource.php @@ -0,0 +1,19 @@ + */ use HasFactory; use HasSlug; + use HasMenuPanel; use InteractsWithMedia; protected static string $factory = PageFactory::class; @@ -25,4 +28,14 @@ class Page extends Model implements HasMedia 'slug', 'content', ]; + + public function getMenuPanelTitleColumn(): string + { + return 'title'; + } + + public function getMenuPanelUrlUsing(): callable + { + return fn (self $model) => $model->url; + } } diff --git a/app/Providers/Filament/AdminPanelProvider.php b/app/Providers/Filament/AdminPanelProvider.php index ec1d732..c0d9000 100644 --- a/app/Providers/Filament/AdminPanelProvider.php +++ b/app/Providers/Filament/AdminPanelProvider.php @@ -6,7 +6,11 @@ use App\Filament\Admin\Pages\Auth\Login; use App\Filament\Admin\Resources\ElectionResource; +use App\Filament\Admin\Resources\MenuResource; use App\Models\Election; +use App\Models\Page; +use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderPlugin; +use Datlechin\FilamentMenuBuilder\MenuPanel\ModelMenuPanel; use Filament\Facades\Filament; use Filament\Forms\Components\DateTimePicker; use Filament\Http\Middleware\Authenticate; @@ -55,6 +59,18 @@ public function panel(Panel $panel): Panel BreezyCore::make() ->myProfile(slug: 'profile') ->enableTwoFactorAuthentication(), + + FilamentMenuBuilderPlugin::make() + ->usingResource(MenuResource::class) + ->addLocations([ + 'header' => 'Header', + 'footer' => 'Footer', + ]) + ->addMenuPanels([ + ModelMenuPanel::make() + ->model(Page::class), + + ]), ]) ->viteTheme('resources/css/filament/common/theme.css') ->discoverResources(in: app_path('Filament/Admin/Resources'), for: 'App\\Filament\\Admin\\Resources') diff --git a/app/View/Components/NavigationItem.php b/app/View/Components/NavigationItem.php index 2823238..f98c2bf 100644 --- a/app/View/Components/NavigationItem.php +++ b/app/View/Components/NavigationItem.php @@ -4,29 +4,20 @@ namespace App\View\Components; -use Closure; +use Datlechin\FilamentMenuBuilder\Models\MenuItem; use Illuminate\Contracts\View\View; -use Illuminate\Support\Facades\Route; use Illuminate\View\Component; class NavigationItem extends Component { - public string $route; + public MenuItem $item; - public string $label; - - public function __construct(string $route, string $label) - { - $this->route = $route; - $this->label = $label; - } - - public function isCurrent(): bool + public function __construct(MenuItem $item) { - return Route::currentRouteName() === $this->route; + $this->item = $item; } - public function render(): View|Closure|string + public function render(): View { return view('components.navigation-item'); } diff --git a/app/View/Components/Site/Header.php b/app/View/Components/Site/Header.php index e9af76a..536c3d8 100644 --- a/app/View/Components/Site/Header.php +++ b/app/View/Components/Site/Header.php @@ -4,8 +4,11 @@ namespace App\View\Components\Site; +use App\Enums\Time; +use Datlechin\FilamentMenuBuilder\Models\Menu; use Illuminate\Contracts\View\View; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Cache; use Illuminate\View\Component; class Header extends Component @@ -18,11 +21,20 @@ public function __construct(bool $timeline = false) { $this->timeline = $timeline; - $this->menuItems = collect([ - 'front.index' => __('app.navigation.home'), - // 'about' => __('app.navigation.about'), - // 'partners' => __('app.navigation.partners'), - ]); + $this->menuItems = $this->getMenuItems(); + } + + protected function getMenuItems(): Collection + { + return Cache::remember('header-menu', Time::DAY_IN_SECONDS, function () { + $menu = Menu::location('header'); + + if (blank($menu)) { + return collect(); + } + + return $menu->menuItems; + }); } public function render(): View diff --git a/composer.json b/composer.json index c20fbec..1e0d5fd 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ "awcodes/filament-tiptap-editor": "^3.4", "blade-ui-kit/blade-icons": "^1.7", "codeat3/blade-google-material-design-icons": "^1.19", + "datlechin/filament-menu-builder": "^0.6.0", "filament/filament": "^3.2", "filament/spatie-laravel-media-library-plugin": "^3.2", "haydenpierce/class-finder": "^0.5.3", diff --git a/composer.lock b/composer.lock index e986348..3979c58 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "ef40933dd50f21c5a6d36047682c0207", + "content-hash": "694a49f405870236432515d4126f965c", "packages": [ { "name": "andreiio/blade-remix-icon", @@ -1130,6 +1130,80 @@ }, "time": "2024-08-09T14:30:48+00:00" }, + { + "name": "datlechin/filament-menu-builder", + "version": "v0.6.0", + "source": { + "type": "git", + "url": "https://github.com/datlechin/filament-menu-builder.git", + "reference": "6859270f54f218e451089549b90a7bf9fe521291" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/datlechin/filament-menu-builder/zipball/6859270f54f218e451089549b90a7bf9fe521291", + "reference": "6859270f54f218e451089549b90a7bf9fe521291", + "shasum": "" + }, + "require": { + "filament/filament": "^3.0", + "php": "^8.1", + "spatie/laravel-package-tools": "^1.15.0" + }, + "require-dev": { + "laravel/pint": "^1.0", + "nunomaduro/collision": "^7.9", + "orchestra/testbench": "^8.0", + "pestphp/pest": "^2.1", + "pestphp/pest-plugin-arch": "^2.0", + "pestphp/pest-plugin-laravel": "^2.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Datlechin\\FilamentMenuBuilder\\FilamentMenuBuilderServiceProvider" + ], + "aliases": { + "FilamentMenuBuilder": "Datlechin\\FilamentMenuBuilder\\Facades\\FilamentMenuBuilder" + } + } + }, + "autoload": { + "psr-4": { + "Datlechin\\FilamentMenuBuilder\\": "src/", + "Datlechin\\FilamentMenuBuilder\\Database\\Factories\\": "database/factories/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ngo Quoc Dat", + "email": "datlechin@gmail.com", + "role": "Developer" + } + ], + "description": "Create and manage menus and menu items", + "homepage": "https://github.com/datlechin/filament-menu-builder", + "keywords": [ + "datlechin", + "filament-menu-builder", + "laravel" + ], + "support": { + "issues": "https://github.com/datlechin/filament-menu-builder/issues", + "source": "https://github.com/datlechin/filament-menu-builder" + }, + "funding": [ + { + "url": "https://github.com/datlechin", + "type": "github" + } + ], + "time": "2024-11-10T05:30:20+00:00" + }, { "name": "dflydev/dot-access-data", "version": "v3.0.3", diff --git a/config/filament-menu-builder.php b/config/filament-menu-builder.php new file mode 100644 index 0000000..c451948 --- /dev/null +++ b/config/filament-menu-builder.php @@ -0,0 +1,11 @@ + [ + 'menus' => 'menus', + 'menu_items' => 'menu_items', + 'menu_locations' => 'menu_locations', + ], +]; diff --git a/database/migrations/0001_01_30_000010_create_menus_table.php b/database/migrations/0001_01_30_000010_create_menus_table.php new file mode 100644 index 0000000..1f2f372 --- /dev/null +++ b/database/migrations/0001_01_30_000010_create_menus_table.php @@ -0,0 +1,54 @@ +id(); + $table->string('name'); + $table->boolean('is_visible')->default(true); + $table->timestamps(); + }); + + Schema::create(config('filament-menu-builder.tables.menu_items'), function (Blueprint $table) { + $table->id(); + + $table->foreignIdFor(Menu::class) + ->constrained() + ->cascadeOnDelete(); + + $table->foreignIdFor(MenuItem::class, 'parent_id') + ->nullable() + ->constrained($table->getTable()) + ->nullOnDelete(); + + $table->nullableMorphs('linkable'); + $table->string('title'); + $table->string('url')->nullable(); + $table->string('target', 10)->default(LinkTarget::Self); + $table->integer('order')->default(0); + $table->timestamps(); + }); + + Schema::create(config('filament-menu-builder.tables.menu_locations'), function (Blueprint $table) { + $table->id(); + + $table->foreignIdFor(Menu::class) + ->constrained() + ->cascadeOnDelete(); + + $table->string('location')->unique(); + $table->timestamps(); + }); + } +}; diff --git a/public/css/datlechin/filament-menu-builder/filament-menu-builder-styles.css b/public/css/datlechin/filament-menu-builder/filament-menu-builder-styles.css new file mode 100644 index 0000000..295c7a7 --- /dev/null +++ b/public/css/datlechin/filament-menu-builder/filament-menu-builder-styles.css @@ -0,0 +1,529 @@ +/*! tailwindcss v3.4.7 | MIT License | https://tailwindcss.com*/ +*, +:after, +:before { + box-sizing: border-box; + border-width: 0; + border-style: solid; + border-color: rgba(var(--gray-200), 1); +} +:after, +:before { + --tw-content: ''; +} +:host, +html { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + -moz-tab-size: 4; + -o-tab-size: 4; + tab-size: 4; + font-family: var(--font-family), ui-sans-serif, system-ui, sans-serif, + 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', + 'Noto Color Emoji'; + font-feature-settings: normal; + font-variation-settings: normal; + -webkit-tap-highlight-color: transparent; +} +body { + margin: 0; + line-height: inherit; +} +hr { + height: 0; + color: inherit; + border-top-width: 1px; +} +abbr:where([title]) { + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; +} +h1, +h2, +h3, +h4, +h5, +h6 { + font-size: inherit; + font-weight: inherit; +} +a { + color: inherit; + text-decoration: inherit; +} +b, +strong { + font-weight: bolder; +} +code, +kbd, +pre, +samp { + font-family: + ui-monospace, + SFMono-Regular, + Menlo, + Monaco, + Consolas, + Liberation Mono, + Courier New, + monospace; + font-feature-settings: normal; + font-variation-settings: normal; + font-size: 1em; +} +small { + font-size: 80%; +} +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: initial; +} +sub { + bottom: -0.25em; +} +sup { + top: -0.5em; +} +table { + text-indent: 0; + border-color: inherit; + border-collapse: collapse; +} +button, +input, +optgroup, +select, +textarea { + font-family: inherit; + font-feature-settings: inherit; + font-variation-settings: inherit; + font-size: 100%; + font-weight: inherit; + line-height: inherit; + letter-spacing: inherit; + color: inherit; + margin: 0; + padding: 0; +} +button, +select { + text-transform: none; +} +button, +input:where([type='button']), +input:where([type='reset']), +input:where([type='submit']) { + -webkit-appearance: button; + background-color: initial; + background-image: none; +} +:-moz-focusring { + outline: auto; +} +:-moz-ui-invalid { + box-shadow: none; +} +progress { + vertical-align: initial; +} +::-webkit-inner-spin-button, +::-webkit-outer-spin-button { + height: auto; +} +[type='search'] { + -webkit-appearance: textfield; + outline-offset: -2px; +} +::-webkit-search-decoration { + -webkit-appearance: none; +} +::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; +} +summary { + display: list-item; +} +blockquote, +dd, +dl, +figure, +h1, +h2, +h3, +h4, +h5, +h6, +hr, +p, +pre { + margin: 0; +} +fieldset { + margin: 0; +} +fieldset, +legend { + padding: 0; +} +menu, +ol, +ul { + list-style: none; + margin: 0; + padding: 0; +} +dialog { + padding: 0; +} +textarea { + resize: vertical; +} +input::-moz-placeholder, +textarea::-moz-placeholder { + opacity: 1; + color: rgba(var(--gray-400), 1); +} +input::placeholder, +textarea::placeholder { + opacity: 1; + color: rgba(var(--gray-400), 1); +} +[role='button'], +button { + cursor: pointer; +} +:disabled { + cursor: default; +} +audio, +canvas, +embed, +iframe, +img, +object, +svg, +video { + display: block; + vertical-align: middle; +} +img, +video { + max-width: 100%; + height: auto; +} +[hidden] { + display: none; +} +[multiple], +[type='date'], +[type='datetime-local'], +[type='email'], +[type='month'], +[type='number'], +[type='password'], +[type='search'], +[type='tel'], +[type='text'], +[type='time'], +[type='url'], +[type='week'], +input:where(:not([type])), +select, +textarea { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + background-color: #fff; + border-color: rgba(var(--gray-500), var(--tw-border-opacity, 1)); + border-width: 1px; + border-radius: 0; + padding: 0.5rem 0.75rem; + font-size: 1rem; + line-height: 1.5rem; + --tw-shadow: 0 0 #0000; +} +[multiple]:focus, +[type='date']:focus, +[type='datetime-local']:focus, +[type='email']:focus, +[type='month']:focus, +[type='number']:focus, +[type='password']:focus, +[type='search']:focus, +[type='tel']:focus, +[type='text']:focus, +[type='time']:focus, +[type='url']:focus, +[type='week']:focus, +input:where(:not([type])):focus, +select:focus, +textarea:focus { + outline: 2px solid #0000; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/); + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow); + border-color: #2563eb; +} +input::-moz-placeholder, +textarea::-moz-placeholder { + color: rgba(var(--gray-500), var(--tw-text-opacity, 1)); + opacity: 1; +} +input::placeholder, +textarea::placeholder { + color: rgba(var(--gray-500), var(--tw-text-opacity, 1)); + opacity: 1; +} +::-webkit-datetime-edit-fields-wrapper { + padding: 0; +} +::-webkit-date-and-time-value { + min-height: 1.5em; + text-align: inherit; +} +::-webkit-datetime-edit { + display: inline-flex; +} +::-webkit-datetime-edit, +::-webkit-datetime-edit-day-field, +::-webkit-datetime-edit-hour-field, +::-webkit-datetime-edit-meridiem-field, +::-webkit-datetime-edit-millisecond-field, +::-webkit-datetime-edit-minute-field, +::-webkit-datetime-edit-month-field, +::-webkit-datetime-edit-second-field, +::-webkit-datetime-edit-year-field { + padding-top: 0; + padding-bottom: 0; +} +select { + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='rgba(var(--gray-500), var(--tw-stroke-opacity, 1))' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E"); + background-position: right 0.5rem center; + background-repeat: no-repeat; + background-size: 1.5em 1.5em; + padding-right: 2.5rem; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; +} +[multiple], +[size]:where(select:not([size='1'])) { + background-image: none; + background-position: 0 0; + background-repeat: unset; + background-size: initial; + padding-right: 0.75rem; + -webkit-print-color-adjust: unset; + print-color-adjust: unset; +} +[type='checkbox'], +[type='radio'] { + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; + padding: 0; + -webkit-print-color-adjust: exact; + print-color-adjust: exact; + display: inline-block; + vertical-align: middle; + background-origin: border-box; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; + flex-shrink: 0; + height: 1rem; + width: 1rem; + color: #2563eb; + background-color: #fff; + border-color: rgba(var(--gray-500), var(--tw-border-opacity, 1)); + border-width: 1px; + --tw-shadow: 0 0 #0000; +} +[type='checkbox'] { + border-radius: 0; +} +[type='radio'] { + border-radius: 100%; +} +[type='checkbox']:focus, +[type='radio']:focus { + outline: 2px solid #0000; + outline-offset: 2px; + --tw-ring-inset: var(--tw-empty, /*!*/ /*!*/); + --tw-ring-offset-width: 2px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #2563eb; + --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 + var(--tw-ring-offset-width) var(--tw-ring-offset-color); + --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 + calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); + box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), + var(--tw-shadow); +} +[type='checkbox']:checked, +[type='radio']:checked { + border-color: #0000; + background-color: currentColor; + background-size: 100% 100%; + background-position: 50%; + background-repeat: no-repeat; +} +[type='checkbox']:checked { + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Cpath d='M12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3E%3C/svg%3E"); +} +@media (forced-colors: active) { + [type='checkbox']:checked { + -webkit-appearance: auto; + -moz-appearance: auto; + appearance: auto; + } +} +[type='radio']:checked { + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23fff' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='3'/%3E%3C/svg%3E"); +} +@media (forced-colors: active) { + [type='radio']:checked { + -webkit-appearance: auto; + -moz-appearance: auto; + appearance: auto; + } +} +[type='checkbox']:checked:focus, +[type='checkbox']:checked:hover, +[type='checkbox']:indeterminate, +[type='radio']:checked:focus, +[type='radio']:checked:hover { + border-color: #0000; + background-color: currentColor; +} +[type='checkbox']:indeterminate { + background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3E%3Cpath stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3E%3C/svg%3E"); + background-size: 100% 100%; + background-position: 50%; + background-repeat: no-repeat; +} +@media (forced-colors: active) { + [type='checkbox']:indeterminate { + -webkit-appearance: auto; + -moz-appearance: auto; + appearance: auto; + } +} +[type='checkbox']:indeterminate:focus, +[type='checkbox']:indeterminate:hover { + border-color: #0000; + background-color: currentColor; +} +[type='file'] { + background: unset; + border-color: inherit; + border-width: 0; + border-radius: 0; + padding: 0; + font-size: unset; + line-height: inherit; +} +[type='file']:focus { + outline: 1px solid ButtonText; + outline: 1px auto -webkit-focus-ring-color; +} +[data-field-wrapper] { + scroll-margin-top: 8rem; +} +*, +::backdrop, +:after, +:before { + --tw-border-spacing-x: 0; + --tw-border-spacing-y: 0; + --tw-translate-x: 0; + --tw-translate-y: 0; + --tw-rotate: 0; + --tw-skew-x: 0; + --tw-skew-y: 0; + --tw-scale-x: 1; + --tw-scale-y: 1; + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; + --tw-gradient-from-position: ; + --tw-gradient-via-position: ; + --tw-gradient-to-position: ; + --tw-ordinal: ; + --tw-slashed-zero: ; + --tw-numeric-figure: ; + --tw-numeric-spacing: ; + --tw-numeric-fraction: ; + --tw-ring-inset: ; + --tw-ring-offset-width: 0px; + --tw-ring-offset-color: #fff; + --tw-ring-color: #3b82f680; + --tw-ring-offset-shadow: 0 0 #0000; + --tw-ring-shadow: 0 0 #0000; + --tw-shadow: 0 0 #0000; + --tw-shadow-colored: 0 0 #0000; + --tw-blur: ; + --tw-brightness: ; + --tw-contrast: ; + --tw-grayscale: ; + --tw-hue-rotate: ; + --tw-invert: ; + --tw-saturate: ; + --tw-sepia: ; + --tw-drop-shadow: ; + --tw-backdrop-blur: ; + --tw-backdrop-brightness: ; + --tw-backdrop-contrast: ; + --tw-backdrop-grayscale: ; + --tw-backdrop-hue-rotate: ; + --tw-backdrop-invert: ; + --tw-backdrop-opacity: ; + --tw-backdrop-saturate: ; + --tw-backdrop-sepia: ; + --tw-contain-size: ; + --tw-contain-layout: ; + --tw-contain-paint: ; + --tw-contain-style: ; +} +.col-span-12 { + grid-column: span 12 / span 12; +} +.ms-4 { + margin-inline-start: 1rem; +} +.rotate-90 { + --tw-rotate: 90deg; + transform: translate(var(--tw-translate-x), var(--tw-translate-y)) + rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) + scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y)); +} +.grid-cols-12 { + grid-template-columns: repeat(12, minmax(0, 1fr)); +} +.text-ellipsis { + text-overflow: ellipsis; +} +.p-2\.5 { + padding: 0.625rem; +} +@media (min-width: 640px) { + .sm\:col-span-4 { + grid-column: span 4 / span 4; + } + .sm\:col-span-8 { + grid-column: span 8 / span 8; + } +} diff --git a/public/js/datlechin/filament-menu-builder/components/filament-menu-builder.js b/public/js/datlechin/filament-menu-builder/components/filament-menu-builder.js new file mode 100644 index 0000000..55b8564 --- /dev/null +++ b/public/js/datlechin/filament-menu-builder/components/filament-menu-builder.js @@ -0,0 +1,23 @@ +// resources/js/index.js +var js_default = ({ parentId }) => ({ + parentId, + sortable: null, + init() { + this.sortable = new Sortable(this.$el, { + group: 'nested', + draggable: '[data-sortable-item]', + handle: '[data-sortable-handle]', + animation: 300, + ghostClass: 'fi-sortable-ghost', + dataIdAttr: 'data-sortable-item', + onSort: () => { + this.$wire.reorder( + this.sortable.toArray(), + this.parentId === 0 ? null : this.parentId, + ) + }, + }) + }, +}) +export { js_default as default } +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vanMvaW5kZXguanMiXSwKICAic291cmNlc0NvbnRlbnQiOiBbImV4cG9ydCBkZWZhdWx0ICh7IHBhcmVudElkIH0pID0+ICh7XG4gICAgcGFyZW50SWQsXG4gICAgc29ydGFibGU6IG51bGwsXG5cbiAgICBpbml0KCkge1xuICAgICAgICB0aGlzLnNvcnRhYmxlID0gbmV3IFNvcnRhYmxlKHRoaXMuJGVsLCB7XG4gICAgICAgICAgICBncm91cDogJ25lc3RlZCcsXG4gICAgICAgICAgICBkcmFnZ2FibGU6ICdbZGF0YS1zb3J0YWJsZS1pdGVtXScsXG4gICAgICAgICAgICBoYW5kbGU6ICdbZGF0YS1zb3J0YWJsZS1oYW5kbGVdJyxcbiAgICAgICAgICAgIGFuaW1hdGlvbjogMzAwLFxuICAgICAgICAgICAgZ2hvc3RDbGFzczogJ2ZpLXNvcnRhYmxlLWdob3N0JyxcbiAgICAgICAgICAgIGRhdGFJZEF0dHI6ICdkYXRhLXNvcnRhYmxlLWl0ZW0nLFxuICAgICAgICAgICAgb25Tb3J0OiAoKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy4kd2lyZS5yZW9yZGVyKFxuICAgICAgICAgICAgICAgICAgICB0aGlzLnNvcnRhYmxlLnRvQXJyYXkoKSxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5wYXJlbnRJZCA9PT0gMCA/IG51bGwgOiB0aGlzLnBhcmVudElkXG4gICAgICAgICAgICAgICAgKVxuICAgICAgICAgICAgfVxuICAgICAgICB9KVxuICAgIH0sXG59KVxuIl0sCiAgIm1hcHBpbmdzIjogIjtBQUFBLElBQU8sYUFBUSxDQUFDLEVBQUUsU0FBUyxPQUFPO0FBQUEsRUFDOUI7QUFBQSxFQUNBLFVBQVU7QUFBQSxFQUVWLE9BQU87QUFDSCxTQUFLLFdBQVcsSUFBSSxTQUFTLEtBQUssS0FBSztBQUFBLE1BQ25DLE9BQU87QUFBQSxNQUNQLFdBQVc7QUFBQSxNQUNYLFFBQVE7QUFBQSxNQUNSLFdBQVc7QUFBQSxNQUNYLFlBQVk7QUFBQSxNQUNaLFlBQVk7QUFBQSxNQUNaLFFBQVEsTUFBTTtBQUNWLGFBQUssTUFBTTtBQUFBLFVBQ1AsS0FBSyxTQUFTLFFBQVE7QUFBQSxVQUN0QixLQUFLLGFBQWEsSUFBSSxPQUFPLEtBQUs7QUFBQSxRQUN0QztBQUFBLE1BQ0o7QUFBQSxJQUNKLENBQUM7QUFBQSxFQUNMO0FBQ0o7IiwKICAibmFtZXMiOiBbXQp9Cg== diff --git a/resources/views/components/navigation-item.blade.php b/resources/views/components/navigation-item.blade.php index 9c02538..423e222 100644 --- a/resources/views/components/navigation-item.blade.php +++ b/resources/views/components/navigation-item.blade.php @@ -2,13 +2,13 @@ merge([ - 'href' => route($route), - 'wire:navigate' => true, + 'href' => $item->url, + 'wire:navigate' => $item->target === '_self', ])->class([ 'font-medium leading-tight', 'text-primary-900 hover:bg-primary-50', - $isCurrent() ? 'bg-primary-50' : '', + // $isCurrent() ? 'bg-primary-50' : '', $mobile ? 'flex px-2 py-3' : 'px-3 py-2 rounded', ]) }}> - {{ $label }} + {{ $item->title }} diff --git a/resources/views/components/site/header.blade.php b/resources/views/components/site/header.blade.php index b228b64..42ee555 100644 --- a/resources/views/components/site/header.blade.php +++ b/resources/views/components/site/header.blade.php @@ -7,8 +7,8 @@
@@ -32,11 +32,11 @@ class="p-2 -m-2 text-gray-700 md:hidden">
-