tidying alert_kinds helper

This commit is contained in:
Adam Piontek 2021-02-26 12:10:00 -05:00
parent 951249be93
commit a815b99f11
3 changed files with 10 additions and 10 deletions

View file

@ -2,9 +2,9 @@
<%# phoenix flash alerts: %>
<div class="container">
<%= for {kind, class} <- alert_kinds() do %>
<%= for {kind, color} <- alert_kinds() do %>
<%= if flash_content = get_flash(@conn, kind) do %>
<div class="<%= class %> alert-dismissible fade show" role="alert">
<div class="alert alert-<%= color %> alert-dismissible fade show" role="alert">
<%= flash_content %>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>

View file

@ -2,9 +2,9 @@
<%# liveview flash alerts: %>
<div class="container">
<%= for {kind, class} <- alert_kinds() do %>
<%= for {kind, color} <- alert_kinds() do %>
<%= if flash_content = live_flash(@flash, kind) do %>
<div class="<%= class %> alert-dismissible fade show" role="alert" id="lv-alert-<%= kind %>" phx-hook="AlertRemover" data-key="<%= kind %>">
<div class="alert alert-<%= color %> alert-dismissible fade show" role="alert" id="lv-alert-<%= kind %>" phx-hook="AlertRemover" data-key="<%= kind %>">
<%= flash_content %>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>

View file

@ -10,12 +10,12 @@ defmodule Bones73kWeb.LayoutView do
def alert_kinds do
[
success: "alert alert-success",
info: "alert alert-info",
error: "alert alert-danger",
warning: "alert alert-warning",
primary: "alert alert-primary",
secondary: "alert alert-secondary"
success: "success",
info: "info",
error: "danger",
warning: "warning",
primary: "primary",
secondary: "secondary"
]
end
end