You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
734 B
35 lines
734 B
2 years ago
|
<.header>
|
||
|
Timeline
|
||
|
<:actions>
|
||
|
<.link patch={~p"/posts/new"}>
|
||
|
<.button>New Post</.button>
|
||
|
</.link>
|
||
|
</:actions>
|
||
|
</.header>
|
||
|
|
||
|
<!-- row_click={&JS.navigate(~p"/posts/#{&1}")} -->
|
||
|
<div id="posts" phx-update="prepend">
|
||
|
<%= for post <- @posts do %>
|
||
|
<.live_component
|
||
|
module={ChirpWeb.PostLive.PostComponent}
|
||
|
id={post.id}
|
||
|
post={post}
|
||
|
/>
|
||
|
<% end %>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
<%= if @live_action in [:new, :edit] do %>
|
||
|
<.modal id="post-modal" show on_cancel={JS.navigate(~p"/posts")}>
|
||
|
<.live_component
|
||
|
module={ChirpWeb.PostLive.FormComponent}
|
||
|
id={@post.id || :new}
|
||
|
title={@page_title}
|
||
|
action={@live_action}
|
||
|
post={@post}
|
||
|
navigate={~p"/posts"}
|
||
|
/>
|
||
|
</.modal>
|
||
|
<% end %>
|