app/views/components/ui/_alert.html.erb in shadcn-ui-0.0.2 vs app/views/components/ui/_alert.html.erb in shadcn-ui-0.0.3

- old
+ new

@@ -1,10 +1,10 @@ <div role="alert" class="<%= alert_classes %> relative w-full rounded-lg border p-4 [&:has(svg)]:pl-11 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4"> <!--prettier-ignore--> - <% case variant %> + <% case variant.to_sym %> <% when :default %> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" @@ -20,11 +20,23 @@ x1="12" x2="20" y1="19" y2="19"></line> </svg> - <% when :error, :alert %> + <% when :info %> + <svg class="h-4 w-4 text-info" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true"> + <path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z" clip-rule="evenodd"></path> + </svg> + <% when :success %> + <svg class="h-4 w-4 text-success" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true"> + <path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z" clip-rule="evenodd"></path> + </svg> + <% when :attention %> + <svg class="h-4 w-4 text-yellow-400" viewBox="0 0 20 20" fill="none" stroke="currentColor" aria-hidden="true"> + <path fill-rule="evenodd" d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path> + </svg> + <% when :error, :destructive, :danger, :alert %> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" @@ -47,9 +59,9 @@ x1="12" x2="12.01" y1="16" y2="16"></line> </svg> - <% end %> + <% end if icon %> <h5 class="mb-1 font-medium leading-none tracking-tight"><%= title %></h5> <div class="text-sm [&_p]:leading-relaxed"><%= description %></div> </div>