diff --git a/app/Views/Components/Alert.php b/app/Views/Components/Alert.php index 41cf3bc51faf9122637914fa9e8bc9f651d0a5f2..9cf300752713c286407f3663c3e2dead6abb8a61 100644 --- a/app/Views/Components/Alert.php +++ b/app/Views/Components/Alert.php @@ -30,6 +30,8 @@ class Alert extends Component $title = $this->title === null ? '' : '<div class="font-semibold">' . $this->title . '</div>'; $class = 'inline-flex w-full p-2 text-sm border rounded ' . $variantClasses[$this->variant] . ' ' . $this->class; + unset($this->attributes['slot']); + unset($this->attributes['variant']); $attributes = stringify_attributes($this->attributes); return <<<HTML diff --git a/themes/cp_install/_layout.php b/themes/cp_install/_layout.php index a8563c046608905719412562d8fd529f0f8d68b1..30d24d6b7ffa2ef93bef967854aba8821d1e935d 100644 --- a/themes/cp_install/_layout.php +++ b/themes/cp_install/_layout.php @@ -23,7 +23,7 @@ </div> </header> <main class="container flex flex-col items-center justify-center flex-1 px-4 py-10 mx-auto"> - <!-- view('_message_block') --> + <?= view('_message_block') ?> <?= $this->renderSection('content') ?> </main> <footer class="container px-2 py-4 mx-auto text-sm text-right border-t border-subtle"> diff --git a/themes/cp_install/_message_block.php b/themes/cp_install/_message_block.php new file mode 100644 index 0000000000000000000000000000000000000000..b52a79f6cf6bc2de2ea9cc96a1257a20c5b85ebe --- /dev/null +++ b/themes/cp_install/_message_block.php @@ -0,0 +1,20 @@ +<?php declare(strict_types=1); + +if (session()->has('message')): ?> + <Alert variant="success" class="max-w-sm mb-4"><?= session('message') ?></Alert> +<?php endif; ?> + +<?php if (session()->has('error')): ?> + <Alert variant="danger" class="max-w-sm mb-4"><?= session('error') ?></Alert> +<?php endif; ?> + +<?php if (session()->has('errors')): ?> + <Alert variant="danger" class="max-w-sm mb-4"> + <ul> + <?php foreach (session('errors') as $error): ?> + <li><?= $error ?></li> + <?php endforeach; ?> + </ul> + </Alert> +<?php endif; +?>