app/views/layouts/_flash.html.erb
<div data-controller="flash" id="application-flash">
<% if flash.any? %>
<% flash.each do |key, value| %>
<div id="flash" class="flash-<%= key %>" data-flash-target="element">
<div class="wrapper">
<span class="flash-content"><%= value.html_safe %></span>
<svg data-action="click->flash#close" width="100%" height="100%" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.5;">
<path d="M0,100L100,0"/>
<path d="M0,0L100,100"/>
</svg>
</div>
</div>
<% end %>
<% end %>
</div>