Skip to content

Commit

Permalink
Add dismission button
Browse files Browse the repository at this point in the history
  • Loading branch information
ptoffy committed May 17, 2023
1 parent 8713ca6 commit 370e49d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Add `Flash` to the package dependencies (in your `Package.swift` file):
```swift
dependencies: [
...,
.package(url: "https://github.com/nodes-vapor/flash.git", from: "4.0.0")
.package(url: "https://github.com/brokenhandsio/flash.git", from: "1.0.0-beta.1")
]
```

Expand Down Expand Up @@ -113,17 +113,21 @@ Using the example above, this is how they are going to be rendered:

```html
<div class="alerts">
<div class="alert alert-success" role="alert">
<div class="alert alert-success alert-dismissible" role="alert">
Successfully saved
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-info" role="alert">
<div class="alert alert-info alert-dismissible" role="alert">
Email sent
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-warning" role="alert">
<div class="alert alert-warning alert-dismissible" role="alert">
Updated user
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<div class="alert alert-danger" role="alert">
<div class="alert alert-danger alert-dismissible" role="alert">
Something went wrong
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
</div>
```
Expand Down
6 changes: 2 additions & 4 deletions Sources/Flash/Tags/FlashTag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@ public struct FlashTag: UnsafeUnescapedLeafTag {

let result: String = request.flashes.map { flash in
"""
<div class=\"alert alert-\(flash.kind.bootstrapClass)\" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<div class=\"alert alert-\(flash.kind.bootstrapClass) alert-dismissible\" role="alert">
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
\(flash.message)
</div>
"""
Expand Down

0 comments on commit 370e49d

Please sign in to comment.