Skip to content

Commit

Permalink
banner hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
devajmeireles committed Aug 14, 2024
1 parent 65956a1 commit 0c38b67
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 3 deletions.
29 changes: 29 additions & 0 deletions app/Enums/Examples/Ui/Banner.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,35 @@ public function save()
}
HTML;

public const CONTROLLERS = <<<'HTML'
use Illuminate\Http\Request;
use TallStackUi\Traits\Interactions;
class PaymentController extends Controller
{
use Interactions; // [tl! highlight]
public function index()
{
return view('payment.index', [
//
]);
}
public function update(Request $request)
{
// ...
$this->banner() // [tl! highlight:5]
->success('...')
->close()
->enter(seconds: 3)
->leave(seconds: 10)
->send();
}
}
HTML;

public const PERSONALIZATION = <<<'HTML'
TallStackUi::personalize()
->banner()
Expand Down
1 change: 1 addition & 0 deletions app/Enums/Examples/Ui/Dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ public function save(): void
// When using `success()`, `error()`, `warning()`, `info()` and pressing the OK button.
'ok' => [
'method' => 'method',
// The parameters can be anything you want: arrays, strings, int.
'params' => ['param1', 'param2']
],
// When close the dialog by clicking on the "x" button.
Expand Down
1 change: 1 addition & 0 deletions app/Enums/Examples/Ui/Toast.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ public function save(): void
// When close the toast by clicking on the "x" button.
'close' => [
'method' => 'method',
// The parameters can be anything you want: arrays, strings, int.
'params' => ['param1', 'param2']
],
// When the toast is automatically closed by the timeout.
Expand Down
3 changes: 2 additions & 1 deletion contents/on-this-page.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@
"5": "Animations",
"6": "Date Limit",
"7": "Size Variations",
"8": "Color Variations & Light Option"
"8": "Color Variations & Light Option",
"9": "Dispatching via Controllers"
}
},
"Livewire Integration": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
</p>
<x-code :contents="$controllers" disable-copy />
<p>
Because certain methods were created and designed to be used with Livewire components,
<u>Because certain methods were created and designed to be used with Livewire components</u>,
methods like <x-block>confirm</x-block>, <x-block>cancel</x-block> and <x-block>hooks</x-block>
will be unavailable and will throw exceptions when you try to use them in controllers.
</p>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/documentation/interactions/toast.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
</p>
<x-code :contents="$controllers" disable-copy />
<p>
Because certain methods were created and designed to be used with Livewire components,
<u>Because certain methods were created and designed to be used with Livewire components</u>,
methods like <x-block>confirm</x-block>, <x-block>cancel</x-block> and <x-block>hooks</x-block>
will be unavailable and will throw exceptions when you try to use them in controllers.
</p>
Expand Down
6 changes: 6 additions & 0 deletions resources/views/documentation/ui/banner.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
<x-section title="Color Variations & Light Option" anchor="static-color-variations-light-option" disable-copy>
<x-code language="blade" :contents="$colors" disable-copy />
</x-section>
<x-section title="Dispatching via Controllers" new anchor="static-dispatching-via-controllers" disable-copy>
<p>
<u>Starting from version 1.35.0</u> you can trigger a banner via controllers.
</p>
<x-code :contents="$controllers" disable-copy />
</x-section>
<x-separator text="Livewire Integration" />
<x-section title="Concept" anchor="livewire-integration-concept" disable-copy>
<p>
Expand Down

0 comments on commit 0c38b67

Please sign in to comment.