From 8bb6b58c528bc69a9738fa388273b1a74abe0574 Mon Sep 17 00:00:00 2001 From: Thiritin Date: Mon, 27 May 2024 02:28:03 +0200 Subject: [PATCH] add dynamic icons --- app/Filament/Resources/AppResource.php | 12 ++++++++---- .../js/Components/Icons/ChairOfficeSolidIcon.vue | 15 +++++++++++++++ .../js/Components/Icons/FoldersSolidIcon.vue | 15 +++++++++++++++ .../js/Components/Icons/IdBadgeSolidIcon.vue | 15 +++++++++++++++ .../js/Components/Icons/QuestionSolidIcon.vue | 15 +++++++++++++++ resources/js/Components/Icons/ShipSolidIcon.vue | 15 +++++++++++++++ resources/js/Components/Icons/StoreSolidIcon.vue | 15 +++++++++++++++ .../js/Components/Icons/TruckLoadingSolidIcon.vue | 15 +++++++++++++++ .../js/Components/Icons/UserShieldSolidIcon.vue | 15 +++++++++++++++ resources/js/Components/Icons/VideoSolidIcon.vue | 15 +++++++++++++++ 10 files changed, 143 insertions(+), 4 deletions(-) create mode 100644 resources/js/Components/Icons/ChairOfficeSolidIcon.vue create mode 100644 resources/js/Components/Icons/FoldersSolidIcon.vue create mode 100644 resources/js/Components/Icons/IdBadgeSolidIcon.vue create mode 100644 resources/js/Components/Icons/QuestionSolidIcon.vue create mode 100644 resources/js/Components/Icons/ShipSolidIcon.vue create mode 100644 resources/js/Components/Icons/StoreSolidIcon.vue create mode 100644 resources/js/Components/Icons/TruckLoadingSolidIcon.vue create mode 100644 resources/js/Components/Icons/UserShieldSolidIcon.vue create mode 100644 resources/js/Components/Icons/VideoSolidIcon.vue diff --git a/app/Filament/Resources/AppResource.php b/app/Filament/Resources/AppResource.php index 8e373be..ae1e009 100644 --- a/app/Filament/Resources/AppResource.php +++ b/app/Filament/Resources/AppResource.php @@ -158,10 +158,14 @@ public static function form(Form $form): Form Checkbox::make('public')->hint('App is publicly visible (ignoring group selection)'), TextInput::make('name')->required(), TextInput::make('description')->required(), - Select::make('icon')->options([ - "TicketDuotone" => "TicketDuotone", - "CogsDuotone" => "CogsDuotone", - ])->hint('Request new Icons @ Thiritin')->required(), + Select::make('icon')->options(function () { + return collect(scandir(resource_path('js/Components/Icons'))) + ->filter(fn($icon) => !in_array($icon, ['.', '..'])) + ->map(fn($icon) => str_replace('.vue', '', $icon)) + ->values() + ->keyBy(fn($icon) => $icon) + ->toArray(); + })->hint('Request new Icons @ Thiritin')->required(), TextInput::make('url')->url(), ]), Card::make()->schema([ diff --git a/resources/js/Components/Icons/ChairOfficeSolidIcon.vue b/resources/js/Components/Icons/ChairOfficeSolidIcon.vue new file mode 100644 index 0000000..d612af4 --- /dev/null +++ b/resources/js/Components/Icons/ChairOfficeSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/FoldersSolidIcon.vue b/resources/js/Components/Icons/FoldersSolidIcon.vue new file mode 100644 index 0000000..fb0dd19 --- /dev/null +++ b/resources/js/Components/Icons/FoldersSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/IdBadgeSolidIcon.vue b/resources/js/Components/Icons/IdBadgeSolidIcon.vue new file mode 100644 index 0000000..1c1e973 --- /dev/null +++ b/resources/js/Components/Icons/IdBadgeSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/QuestionSolidIcon.vue b/resources/js/Components/Icons/QuestionSolidIcon.vue new file mode 100644 index 0000000..b08cedd --- /dev/null +++ b/resources/js/Components/Icons/QuestionSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/ShipSolidIcon.vue b/resources/js/Components/Icons/ShipSolidIcon.vue new file mode 100644 index 0000000..9a82d5e --- /dev/null +++ b/resources/js/Components/Icons/ShipSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/StoreSolidIcon.vue b/resources/js/Components/Icons/StoreSolidIcon.vue new file mode 100644 index 0000000..92b7fad --- /dev/null +++ b/resources/js/Components/Icons/StoreSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/TruckLoadingSolidIcon.vue b/resources/js/Components/Icons/TruckLoadingSolidIcon.vue new file mode 100644 index 0000000..88cae83 --- /dev/null +++ b/resources/js/Components/Icons/TruckLoadingSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/UserShieldSolidIcon.vue b/resources/js/Components/Icons/UserShieldSolidIcon.vue new file mode 100644 index 0000000..20ba6bf --- /dev/null +++ b/resources/js/Components/Icons/UserShieldSolidIcon.vue @@ -0,0 +1,15 @@ + + + + + diff --git a/resources/js/Components/Icons/VideoSolidIcon.vue b/resources/js/Components/Icons/VideoSolidIcon.vue new file mode 100644 index 0000000..5608424 --- /dev/null +++ b/resources/js/Components/Icons/VideoSolidIcon.vue @@ -0,0 +1,15 @@ + + + + +