mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 03:54:08 +00:00
feat: created Badge component
This commit is contained in:
22
app/views/shared/_badge.html.erb
Normal file
22
app/views/shared/_badge.html.erb
Normal file
@@ -0,0 +1,22 @@
|
||||
<%# locals: (color: nil, pulse: false) %>
|
||||
|
||||
<%
|
||||
def badge_classes(c, p)
|
||||
classes = case c
|
||||
when 'success'
|
||||
'bg-green-500/5 text-green-500'
|
||||
when 'error'
|
||||
'bg-red-500/5 text-red-500'
|
||||
when 'warning'
|
||||
'bg-orange-500/5 text-orange-500'
|
||||
else
|
||||
'bg-gray-500/5 text-secondary'
|
||||
end
|
||||
|
||||
p ? "#{classes} animate-pulse" : classes
|
||||
end
|
||||
%>
|
||||
|
||||
<span class="inline-flex items-center px-2 py-0.5 rounded-full ring ring-alpha-black-50 text-xs <%= badge_classes(color, pulse) %>">
|
||||
<%= yield %>
|
||||
</span>
|
||||
Reference in New Issue
Block a user