Skip to content

Commit 52dcd4c

Browse files
authored
Add Bootstrap5 template then set it to default (#25)
1 parent 96d3716 commit 52dcd4c

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ The Config file consists of two properties.
4646

4747
The `$template` property sets the path to the View file which will be used to format your
4848
alerts. The default template has HTML tags and classes designed for use with
49-
[Bootstrap 4 Alerts](https://getbootstrap.com/docs/4.6/components/alerts/), but the library
49+
[Bootstrap 5 Alerts](https://getbootstrap.com/docs/5.2/components/alerts/), but the library
5050
includes additional templates for you to choose:
51+
* `Tatter\Alerts\Views\Bootstrap4`: Compatible with the Bootstrap 4 CSS Framework
5152
* `Tatter\Alerts\Views\Foundation`: Compatible with the Foundation CSS Framework
5253
* `Tatter\Alerts\Views\Vanilla`: A framework-free implementation, with classes available for your own CSS styling
5354

src/Config/Alerts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Alerts extends BaseConfig
99
/**
1010
* Template to use for HTML output.
1111
*/
12-
public string $template = 'Tatter\Alerts\Views\Bootstrap4';
12+
public string $template = 'Tatter\Alerts\Views\Bootstrap5';
1313

1414
/**
1515
* Mapping of Session keys to their CSS classes.

src/Views/Bootstrap5.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
<?php foreach ($alerts as $alert): ?>
3+
<?php [$class, $content] = $alert; ?>
4+
<div role="alert" class="alert alert-<?= $class ?> alert-dismissible fade show">
5+
<?= $content ?>
6+
7+
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
8+
</div>
9+
<?php endforeach; ?>

0 commit comments

Comments
 (0)