<section class="animated-shadow-sky sky-section">
  <h2 class="section-header">
    <span class="font-medium text-slate-900">Recent Posts</span>
    <span class="float-right">
      <%= link_to "#{user.user_post_creations.size} total", domain_user_posts_path(user), class: "blue-link" %>
    </span>
  </h2>
  <% recent_posts = user.posts.limit(5).to_a %>
  <% if recent_posts.any? %>
    <% recent_posts.each do |post| %>
      <div class="flex items-center px-4 py-2 gap-1">
        <span class="grow truncate">
          <%= render(
            partial: "domain/has_description_html/inline_link_domain_post",
            locals: {
              post: post,
              visual_style: "sky-link"
            }
          ) %>
        </span>
        <span class="whitespace-nowrap text-slate-500">
          <% if posted_at = post.posted_at %>
            <%= time_ago_in_words(posted_at) %> ago
          <% else %>
            unknown
          <% end %>
        </span>
      </div>
    <% end %>
  <% else %>
    <div class="px-4 py-3 text-slate-500">No posts found</div>
  <% end %>
</section>
