Skip to content

Commit

Permalink
Inline warning
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed May 16, 2024
1 parent 98ea453 commit b998bb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 0 additions & 4 deletions app/assets/images/tailwind/warning.svg

This file was deleted.

4 changes: 3 additions & 1 deletion app/components/tailwind/alert_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
<%= render Tailwind::Icon.new(name: :clapping) %>
</div>
<% when :warning %>
<%= image_tag "tailwind/warning.svg", class: "mr-5", alt: "Warning" %>
<div class="mr-5 text-white">
<%= render Tailwind::Icon.new(name: :warning) %>
</div>
<% else %>
<% raise "Invalid value for type: #{type}" %>
<% end %>
Expand Down
6 changes: 6 additions & 0 deletions app/components/tailwind/icon.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@
<path d="M101 31.3387L114 20.3223" stroke="#414860" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
<path d="M126.771 61.1604L141 57.7695" stroke="#414860" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" />
</svg>
<% when :warning %>
<%# TODO: Don't hardcode warning colour %>
<svg width="47" height="47" viewBox="0 0 47 47" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21.768 3C22.5378 1.66666 24.4623 1.66667 25.2321 3L42.1195 32.25C42.8893 33.5833 41.9271 35.25 40.3875 35.25H6.6125C5.0729 35.25 4.11065 33.5833 4.88045 32.25L21.768 3Z" fill="currentColor" />
<path d="M25.488 14.754L25.048 24.39H22.232L21.792 14.754H25.488ZM23.64 26.392C24.1973 26.392 24.6667 26.59 25.048 26.986C25.444 27.3673 25.642 27.8293 25.642 28.372C25.642 28.9293 25.444 29.406 25.048 29.802C24.6667 30.1833 24.1973 30.374 23.64 30.374C23.0973 30.374 22.628 30.1833 22.232 29.802C21.8507 29.406 21.66 28.9293 21.66 28.372C21.66 27.8293 21.8507 27.3673 22.232 26.986C22.628 26.59 23.0973 26.392 23.64 26.392Z" fill="#B90000" />
</svg>
<% else %>
<% raise "Unexpected name #{@name}" %>
<% end %>

0 comments on commit b998bb2

Please sign in to comment.