Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
671 B
Raw Blame
<%= turbo_frame_tag dom_id(@account, :sparkline) do %>
  <div class="flex items-center justify-end gap-1">
    <div class="w-8 h-5">
      <%= render "shared/sparkline", id: dom_id(@account, :sparkline_chart), series: @sparkline_series %>
    </div>

    <%# A previous value of zero makes the percentage infinite, with nothing useful to print %>
    <% if @sparkline_series.trend && @sparkline_series.trend.percent.finite? %>
      <%= tag.p @sparkline_series.trend.percent_formatted,
                  style: "color: #{@sparkline_series.trend.color}",
                  class: "font-mono text-right text-xs font-medium text-primary" %>
    <% end %>
  </div>
<% end %>