改进 Alert
This commit is contained in:
parent
802a626419
commit
429b25afee
@ -7,16 +7,6 @@
|
||||
|
||||
class Alert extends Component
|
||||
{
|
||||
/**
|
||||
* Create a new component instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
|
20
app/View/Components/AlertDanger.php
Normal file
20
app/View/Components/AlertDanger.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class AlertDanger extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return View|Closure|string
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.alert-danger');
|
||||
}
|
||||
}
|
20
app/View/Components/AlertInfo.php
Normal file
20
app/View/Components/AlertInfo.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class AlertInfo extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return View|Closure|string
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.alert-info');
|
||||
}
|
||||
}
|
20
app/View/Components/AlertSuccess.php
Normal file
20
app/View/Components/AlertSuccess.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class AlertSuccess extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return View|Closure|string
|
||||
*/
|
||||
public function render(): View|string|Closure
|
||||
{
|
||||
return view('components.alert-success');
|
||||
}
|
||||
}
|
20
app/View/Components/AlertWarning.php
Normal file
20
app/View/Components/AlertWarning.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\View\Components;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\View\Component;
|
||||
|
||||
class AlertWarning extends Component
|
||||
{
|
||||
/**
|
||||
* Get the view / contents that represent the component.
|
||||
*
|
||||
* @return View|Closure|string
|
||||
*/
|
||||
public function render(): View|Closure|string
|
||||
{
|
||||
return view('components.alert-warning');
|
||||
}
|
||||
}
|
11
resources/views/components/alert-danger.blade.php
Normal file
11
resources/views/components/alert-danger.blade.php
Normal file
@ -0,0 +1,11 @@
|
||||
<div>
|
||||
<div class="alert alert-danger d-flex align-items-center alert-dismissible fade show" role="alert">
|
||||
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Danger:">
|
||||
<use xlink:href="#exclamation-triangle-fill"/>
|
||||
</svg>
|
||||
<div>
|
||||
{{ $slot }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
11
resources/views/components/alert-info.blade.php
Normal file
11
resources/views/components/alert-info.blade.php
Normal file
@ -0,0 +1,11 @@
|
||||
<div>
|
||||
<div class="alert alert-primary d-flex align-items-center alert-dismissible fade show" role="alert">
|
||||
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Info:">
|
||||
<use xlink:href="#info-fill"/>
|
||||
</svg>
|
||||
<div>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
11
resources/views/components/alert-success.blade.php
Normal file
11
resources/views/components/alert-success.blade.php
Normal file
@ -0,0 +1,11 @@
|
||||
<div>
|
||||
<div class="alert alert-success d-flex align-items-center alert-dismissible fade show" role="alert">
|
||||
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Success:">
|
||||
<use xlink:href="#check-circle-fill"/>
|
||||
</svg>
|
||||
<div>
|
||||
{{ $slot }}
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
3
resources/views/components/alert-warning.blade.php
Normal file
3
resources/views/components/alert-warning.blade.php
Normal file
@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<!-- Because you are alive, everything is possible. - Thich Nhat Hanh -->
|
||||
</div>
|
@ -14,63 +14,29 @@
|
||||
</symbol>
|
||||
</svg>
|
||||
@if (session('error'))
|
||||
<div>
|
||||
<div class="alert alert-danger d-flex align-items-center alert-dismissible fade show" role="alert">
|
||||
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Danger:">
|
||||
<use xlink:href="#exclamation-triangle-fill"/>
|
||||
</svg>
|
||||
<div>
|
||||
{{ session('error') }}
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<x-alert-danger>
|
||||
{{ session('error') }}
|
||||
</x-alert-danger>
|
||||
@endif
|
||||
@if (session('status'))
|
||||
<div>
|
||||
<div class="alert alert-primary d-flex align-items-center alert-dismissible fade show" role="alert">
|
||||
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Info:">
|
||||
<use xlink:href="#info-fill"/>
|
||||
</svg>
|
||||
<div>
|
||||
{{ session('status') }}
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<x-alert-info>
|
||||
{{ session('status') }}
|
||||
</x-alert-info>
|
||||
@endif
|
||||
|
||||
@if (session('success'))
|
||||
<div>
|
||||
<div class="alert alert-success d-flex align-items-center alert-dismissible fade show" role="alert">
|
||||
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Success:">
|
||||
<use xlink:href="#check-circle-fill"/>
|
||||
</svg>
|
||||
<div>
|
||||
{{ session('success') }}
|
||||
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
<x-alert-success>
|
||||
{{ session('success') }}
|
||||
</x-alert-success>
|
||||
@endif
|
||||
@if (isset($errors) && $errors->any())
|
||||
<div>
|
||||
<div class="alert alert-danger d-flex align-items-center alert-dismissible fade show" role="alert">
|
||||
<svg class="bi flex-shrink-0 me-2" width="24" height="24" role="img" aria-label="Danger:">
|
||||
<use xlink:href="#exclamation-triangle-fill"/>
|
||||
</svg>
|
||||
<div>
|
||||
<ul class="mb-0">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<x-alert-danger>
|
||||
<ul class="mb-0">
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</x-alert-danger>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user