/
_photo.html.erb
30 lines (30 loc) · 1.05 KB
/
_photo.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<%= content_tag :div,
class: "photo-viewer",
style: "view-transition-name: #{dom_id(photo)}",
id: dom_id(photo) do %>
<div class="photo-viewer__container">
<img class="photo-viewer__image" src="<%= photo.url %>" alt="<%= photo.name %>">
<div class="photo-viewer__back-link">
<%= link_to photos_path, class: "back-link__link" do %>
<svg
xmlns="http://www.w3.org/2000/svg"
class="back-link__icon"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2"
>
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7"/>
</svg>
<% end %>
</div>
<div class="photo-viewer__like-button" style="view-transition-name: zoom">
<%= form_for(photo) do |f| %>
<%= f.button type: 'submit', class: "like-button__link" do %>
<span class="like-button__icon">❤️</span>
<span class="like-button__count"><%= photo.likes_count %></span>
<% end %>
<% end %>
</div>
</div>
<% end %>