theseus/app/views/shared/_flash.html.erb
2025-05-31 23:25:41 -04:00

28 lines
No EOL
1.5 KiB
Text

<% flash.each do |type, message| %>
<% if message.present? %>
<% alert_class = case type.to_sym
when :success then 'banner-success'
when :notice, :info then 'banner-info'
when :warning then 'banner-warning'
when :alert, :error, :danger then 'banner-danger'
else 'alert-info'
end %>
<div class="banner <%= alert_class %> mb-4 flex items-center ">
<% case type.to_sym %>
<% when :success %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7" />
</svg>
<% when :notice, :info %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
<% when :warning, :alert, :error, :danger %>
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 mr-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
</svg>
<% end %>
<%= message %>
</div>
<% end %>
<% end %>