feat: Add dynamic comment rendering for mobile view

This commit is contained in:
Kerby Martino authored and Kerby Martino (aider) committed 2025-05-02 14:09:46 +08:00
1 parent 7957ddac02
commit 99ec3b3454
1 file changed
+15 -6
+15 -6
View File
@@ -1,23 +1,32 @@
<div id="mobile-comments-list" class="space-y-4"> <h3 class="mt-4 text-lg font-medium">Comments</h3>
{% assign top_comments = site.comments | where: "parent", nil | sort: "date" %}
<div class="mt-4">
<div id="mobile-comments-list" class="space-y-4">
{% for comment in top_comments %}
<div class="border-b border-gray-200 pb-3 mb-3" id="mobile-comment-comment1"> <div class="border-b border-gray-200 pb-3 mb-3" id="mobile-comment-comment1">
<p class="text-sm mb-2">Haha, this totally happened to me last year. We had a phantom chair thief at work and it became an ongoing office joke for months! <p class="text-sm mb-2">{{ comment.content }}
</p> </p>
<div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2"> <div class="mt-2 mb-1 text-sm flex flex-col md:flex-row items-start md:items-center md:space-x-2">
<div class="flex items-start space-x-2 mb-2 md:mb-0"> <div class="flex items-start space-x-2 mb-2 md:mb-0">
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover"> <span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
<i class="fa-solid fa-arrow-up mr-1"></i> 100 <i class="fa-solid fa-arrow-up mr-1"></i> {{ comment.upvotes }}
</span> </span>
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover"> <span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
<i class="fas fa-reply mr-1"></i> REPLY <i class="fas fa-reply mr-1"></i> REPLY
</span> </span>
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover"> <span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center cursor-pointer hover:bg-link-hover">
<i class="fas fa-comment mr-1"></i> 10 <i class="fas fa-comment mr-1"></i> {{ comment.replies }}
</span> </span>
</div> </div>
<small class="text-sm font-action"> <small class="text-sm font-action">
<a href="#" class="text-sm hover:underline">commenter1</a> <a href="#" class="text-sm hover:underline">{{ comment.author }}</a>
<span class="text-text-muted text-sm opacity-75">02 Oct 2023</span> <span class="text-text-muted text-sm opacity-75">{{ comment.date | date: "%d %b %Y" }}</span>
</small> </small>
</div> </div>
</div> </div>
{% endfor %}
</div>
</div> </div>