From d55620f70a737a18d4c0f6930b34a671bf6b28ed Mon Sep 17 00:00:00 2001 From: Pedro Cabral Date: Tue, 21 Apr 2026 14:33:46 +0200 Subject: [PATCH] WIP: added button component improve disabled and hover states --- app/View/Components/Button.php | 43 +++++++++++++++++++++ resources/views/components/button.blade.php | 8 ++++ resources/views/storybook/index.blade.php | 32 +++++++-------- 3 files changed, 65 insertions(+), 18 deletions(-) create mode 100644 app/View/Components/Button.php create mode 100644 resources/views/components/button.blade.php diff --git a/app/View/Components/Button.php b/app/View/Components/Button.php new file mode 100644 index 0000000..6b241f8 --- /dev/null +++ b/app/View/Components/Button.php @@ -0,0 +1,43 @@ + 'bg-primary text-text-inverted hover:bg-blue-700', + 'secondary' => 'bg-secondary text-text hover:bg-gray-300', + 'outline' => 'border border-primary text-primary hover:bg-red-700', + ]; + + $disabled = 'disabled:bg-gray-300 disabled:text-gray-500 disabled:cursor-not-allowed disabled:opacity-60'; + + return trim( + $base . ' ' . + ($variants[$this->variant] ?? $variants['primary']) . ' ' . + $disabled + ); + } + + /** + * Get the view / contents that represent the component. + */ + public function render(): View|Closure|string + { + return view('components.button'); + } +} diff --git a/resources/views/components/button.blade.php b/resources/views/components/button.blade.php new file mode 100644 index 0000000..4e20927 --- /dev/null +++ b/resources/views/components/button.blade.php @@ -0,0 +1,8 @@ + diff --git a/resources/views/storybook/index.blade.php b/resources/views/storybook/index.blade.php index 59b0a40..b3fa365 100644 --- a/resources/views/storybook/index.blade.php +++ b/resources/views/storybook/index.blade.php @@ -27,33 +27,29 @@

Enabled

- + Default - + Primary - + + Secondary + + + Outline

Disabled

- + Default - + Primary - + + Secondary + + + Outline