Trying to reconstruct the post_component.ex
at this point in the walk-thru.
I tried to piece together the rest of the lines at live_patch
and link
but failed. This is what I have:
defmodule ChirpWeb.PostLive.PostComponent do
use ChirpWeb, :live_component
def render(assigns) do
~L"""
<div id="post"-<%= @post.id %>" class="post">
<div class="row">
<div class="column column-10">
<div class="post-avatar"></div>
</div>
<div class="column column-90 post-body">
<b>@<%= @post.username %></b>
<br />
<%= @post.body %>
</div>
</div>
<div class="row">
<div class="column">
<i class="far f-heart"></i> <%= @post.likes_count %>
</div>
<div class="column">
<i clas="far fa-retweet"></i> <%= @post.reposts_count %>
</div>
<div class="column">
<%= live_patch to: Routes.post_index_path(@socket, :edit, @post.id) %>
<i class="far fa-edit"></i>
<% end %>
<%= link to: "#", phx_click: "delete", phx_value_id: @post.id, data: [confirm: "Are you sure?"] %>
<i class="far fa-trash-alt"></i>
<% end %>
</div>
</div>
</div>
"""
end
end
What I get is: