From 13e07c7fedeaf728508182f32ef20b3ab2bd5109 Mon Sep 17 00:00:00 2001 From: MimisK13 Date: Sun, 5 Nov 2023 18:02:36 +0200 Subject: [PATCH] add simple components --- src/LaravelTablerServiceProvider.php | 5 + .../views/components/alert.blade.php | 25 ++ .../views/components/button.blade.php | 18 + .../resources/views/components/card.blade.php | 29 ++ .../resources/views/components/form.blade.php | 12 + .../views/components/input.blade.php | 39 ++ .../views/components/table.blade.php | 17 + .../views/components/table/td.blade.php | 5 + .../resources/views/layouts/tabler.blade.php | 423 ++---------------- stubs/default/routes/web.php | 4 + 10 files changed, 185 insertions(+), 392 deletions(-) create mode 100644 stubs/default/resources/views/components/alert.blade.php create mode 100644 stubs/default/resources/views/components/button.blade.php create mode 100644 stubs/default/resources/views/components/card.blade.php create mode 100644 stubs/default/resources/views/components/form.blade.php create mode 100644 stubs/default/resources/views/components/input.blade.php create mode 100644 stubs/default/resources/views/components/table.blade.php create mode 100644 stubs/default/resources/views/components/table/td.blade.php diff --git a/src/LaravelTablerServiceProvider.php b/src/LaravelTablerServiceProvider.php index fb90da0..0a70b2d 100644 --- a/src/LaravelTablerServiceProvider.php +++ b/src/LaravelTablerServiceProvider.php @@ -81,6 +81,11 @@ protected function bootForConsole(): void __DIR__.'/../resources/views/errors' => base_path('resources/views/vendor/mimisk13'), ], 'tabler.views'); + // Components + $this->publishes([ + __DIR__.'/../resources/views/components' => base_path('resources/views/vendor/mimisk13'), + ], 'tabler.components'); + $this->publishes([ __DIR__.'/../vite.config.js' => base_path(), ], 'tabler.vite-config'); diff --git a/stubs/default/resources/views/components/alert.blade.php b/stubs/default/resources/views/components/alert.blade.php new file mode 100644 index 0000000..a68e274 --- /dev/null +++ b/stubs/default/resources/views/components/alert.blade.php @@ -0,0 +1,25 @@ +@props([ + // TODO: WIP +]) + +@if (session('success')) + +@endif + +@if ($errors->any()) + +@endif diff --git a/stubs/default/resources/views/components/button.blade.php b/stubs/default/resources/views/components/button.blade.php new file mode 100644 index 0000000..0fa01b3 --- /dev/null +++ b/stubs/default/resources/views/components/button.blade.php @@ -0,0 +1,18 @@ +@props([ + 'type' => null ?? 'button', + + 'route' +]) + + +@isset($route) + + class(['btn btn-primary w-100']) }}> + {{ $slot }} + + +@else + +@endisset diff --git a/stubs/default/resources/views/components/card.blade.php b/stubs/default/resources/views/components/card.blade.php new file mode 100644 index 0000000..6e52bb2 --- /dev/null +++ b/stubs/default/resources/views/components/card.blade.php @@ -0,0 +1,29 @@ +@props([ + 'header', + 'content', + 'footer' +]) + +
class(['card']) }}> + + @isset($header) +
attributes->class(['card-header']) }}> +

+ {{ $header }} +

+
+ @endisset + + @isset($content) +
attributes->class(['card-body']) }}> + {{ $content }} +
+ @endisset + + @isset($footer) +
attributes->class(['card-footer']) }}> + {{ $footer }} +
+ @endisset + +
diff --git a/stubs/default/resources/views/components/form.blade.php b/stubs/default/resources/views/components/form.blade.php new file mode 100644 index 0000000..a6aac4a --- /dev/null +++ b/stubs/default/resources/views/components/form.blade.php @@ -0,0 +1,12 @@ +@props([ + 'action', + 'method' + +]) + +
+ @method($method) + @csrf + + {{ $slot }} +
diff --git a/stubs/default/resources/views/components/input.blade.php b/stubs/default/resources/views/components/input.blade.php new file mode 100644 index 0000000..5ecd968 --- /dev/null +++ b/stubs/default/resources/views/components/input.blade.php @@ -0,0 +1,39 @@ +@props([ + 'label' => null ?? ucfirst($name), + 'type' => null ?? 'text', + 'name', + 'id' => null ?? $name, + 'placeholder' => null, + 'autocomplete' => null ?? 'off', + 'readonly' => false, + 'disabled' => false, + 'required' => false, + 'value' => null ?? old($name) +]) + +
+ + + + + @error($name) +
+ {{ $message }} +
+ @enderror +
diff --git a/stubs/default/resources/views/components/table.blade.php b/stubs/default/resources/views/components/table.blade.php new file mode 100644 index 0000000..7db88a5 --- /dev/null +++ b/stubs/default/resources/views/components/table.blade.php @@ -0,0 +1,17 @@ +@props([ + 'thead', +]) + +
+ + + + {{ $thead }} + + + + + {{ $slot }} + +
+
diff --git a/stubs/default/resources/views/components/table/td.blade.php b/stubs/default/resources/views/components/table/td.blade.php new file mode 100644 index 0000000..921e708 --- /dev/null +++ b/stubs/default/resources/views/components/table/td.blade.php @@ -0,0 +1,5 @@ +@props([ + +]) + +{{ $slot }} diff --git a/stubs/default/resources/views/layouts/tabler.blade.php b/stubs/default/resources/views/layouts/tabler.blade.php index 6d3a888..99dbf71 100644 --- a/stubs/default/resources/views/layouts/tabler.blade.php +++ b/stubs/default/resources/views/layouts/tabler.blade.php @@ -4,7 +4,7 @@ - {{ config('app.name') }} + {{ config('app.name') }} @@ -19,7 +19,12 @@ body { font-feature-settings: "cv03", "cv04", "cv11"; } + + .form-control:focus { + box-shadow: none; + } + {{--- Page Styles ---}} @stack('page-styles') @@ -33,7 +38,7 @@

- + Tabler

@@ -154,411 +159,43 @@ + +
@yield('content')
+