analytics/lib/plausible_web/templates/stats/_bar_graph.html.eex
2019-09-02 12:29:19 +01:00

30 lines
1.3 KiB
Elixir

<div class="w-full md:w-31percent bg-white shadow-md rounded mt-4 p-4">
<div class="text-center">
<h2><%= @title %></h2>
<div class="text-grey-darker mt-1">by <%= @by %></div>
</div>
<div class="mt-8">
<%= for {key, count} <- @list do %>
<div class="flex items-center justify-between my-2">
<%= case key do %>
<% {:link, name, to} -> %>
<%= link(name, to: to, "data-pushstate": true, class: "hover:underline") %>
<% key -> %>
<span class="truncate" style="max-width: 80%;"><%= key %></span>
<% end %>
<span><%= count %></span>
</div>
<%= bar(count, @list, @color) %>
<% end %>
</div>
<%= if Enum.count(@list) >= 5 do %>
<div class="text-center">
<a href="<%= assigns[:link] || "/referrers" %>" data-pushstate class="font-bold text-sm text-grey-dark hover:text-red transition tracking-wide">
<svg style="fill: #8795a1;" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-maximize"><path d="M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"/></svg>
MORE
</a>
</div>
<% end %>
</div>