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