/
_photo.html.erb
22 lines (22 loc) · 1.06 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
<%= 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>
<%= turbo_frame_tag dom_id(photo, :likes) do %>
<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>
<% end %>
</div>
<% end %>