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: %> <%# phoenix flash alerts: %>
<div class="container"> <div class="container">
<%= for {kind, class} <- alert_kinds() do %> <%= for {kind, color} <- alert_kinds() do %>
<%= if flash_content = get_flash(@conn, kind) 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 %> <%= flash_content %>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div> </div>

View File

@ -2,9 +2,9 @@
<%# liveview flash alerts: %> <%# liveview flash alerts: %>
<div class="container"> <div class="container">
<%= for {kind, class} <- alert_kinds() do %> <%= for {kind, color} <- alert_kinds() do %>
<%= if flash_content = live_flash(@flash, kind) 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 %> <%= flash_content %>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div> </div>

View File

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