<%# locals: { trend:, comparison_label: nil } %>

<p class="text-sm" style="color: <%= trend.color %>">
  <% if trend.direction.flat? %>
    <%= t(".no_change") %><%= " #{comparison_label}" if defined?(comparison_label) && comparison_label.present? %>
  <% else %>
    <span class="font-mono">
      <%= trend.value.is_a?(Money) ? format_money(trend.value) : trend.value.round(2) %>
    </span>
    <% unless trend.percent.infinite? %>
      <span class="font-mono">(<%= icon(trend.icon, size: "sm", color: "current", class: "mb-0.5 inline") %><%= trend.percent_formatted %>)</span>
    <% end %>
    <span class="text-secondary">
      <%= " #{comparison_label}" if defined?(comparison_label) && comparison_label.present? %>
    </span>
  <% end %>
</p>
