defmodule ChirpWeb.PostLive.PostComponent do use ChirpWeb, :live_component @spec render(any) :: Phoenix.LiveView.Rendered.t() def render(assigns) do ~H"""
<%= @post.username %>
<%= @post.body %>
<.link navigate={~p"/posts/#{@post}"} class="inline-flex items-center text-blue-600 hover:underline"> Show
<.link phx-click="like" phx-value-id={@post.id}> <%= @post.likes_count %>
<.link phx-click="repost" phx-value-id={@post.id}>
<%= @post.reposts_count %>
<.link patch={~p"/posts/#{@post}/edit"}>Edit
<.link phx-click={JS.push("delete", value: %{id: @post.id})} data-confirm="Are you sure?"> Delete
""" end end