.header>
Timeline
<:actions>
<.link patch={~p"/posts/new"}>
<.button>New Post
<%= for post <- @posts do %>
<.live_component
module={ChirpWeb.PostLive.PostComponent}
id={post.id}
post={post}
/>
<% end %>
<%= 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"}
/>
<% end %>