feat: update mobile comment view to use nested comments

This commit is contained in:
Kerby Martino authored and Kerby Martino (aider) committed 2025-05-02 23:52:10 +08:00
1 parent 05a4cf1c64
commit 0d4e9c002a
5 files changed
+25 -201

No files matched your search

+21 -38
View File
@@ -8,68 +8,51 @@
</div>
<div id="mobile-comment-thread-content">
<div class="border-b border-gray-200 pb-3 mb-3">
<p class="text-sm mb-2">This is the parent comment content.</p>
<p class="text-sm mb-2">{{ page.content }}</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="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">
<i class="fa-solid fa-arrow-up mr-1"></i> 5
<i class="fa-solid fa-arrow-up mr-1"></i> {{ page.upvotes }}
</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">
<i class="fas fa-reply mr-1"></i> REPLY
</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">
<i class="fas fa-comment mr-1"></i> 2
<i class="fas fa-comment mr-1"></i> {{ page.replies }}
</span>
</div>
<small class="text-sm font-action">
<a href="#" class="text-sm hover:underline">Author Name</a>
<span class="text-text-muted text-sm opacity-75">10 Oct 2023</span>
<a href="#" class="text-sm hover:underline">{{ page.author }}</a>
<span class="text-text-muted text-sm opacity-75">{{ page.date | date: "%d %b %Y" }}</span>
</small>
</div>
</div>
<div class="ml-4 mt-3 border-l-2 border-gray-200 pl-2">
<div class="mb-3 pb-3 border-b border-gray-200">
<p class="text-sm mb-2">This is a reply to the parent comment.</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="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">
<i class="fa-solid fa-arrow-up mr-1"></i> 5
</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">
<i class="fas fa-reply mr-1"></i> REPLY
</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">
<i class="fas fa-comment mr-1"></i> 2
</span>
</div>
<small class="text-sm font-action">
<a href="#" class="text-sm hover:underline">Reply Author 1</a>
<span class="text-text-muted text-sm opacity-75">11 Oct 2023</span>
</small>
</div>
</div>
{% assign nested_comments = site.comments | where: "parent", page.slug | sort: "date" %}
<div class="mb-3">
<p class="text-sm mb-2">This is another reply to the parent comment.</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="flex items-start space-x-2 mb-2 md:mb-0">
{% for comment in nested_comments %}
<div class="mb-3 pb-3 border-b border-gray-200">
<p class="text-sm mb-2">{{ comment.content }}</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="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">
<i class="fa-solid fa-arrow-up mr-1"></i> 5
<i class="fa-solid fa-arrow-up mr-1"></i>
</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
</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">
<i class="fas fa-comment mr-1"></i> 2
<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> {{ comment.replies }}
</span>
</div>
<small class="text-sm font-action">
<a href="#" class="text-sm hover:underline">{{ comment.author }}</a>
<span class="text-text-muted text-sm opacity-75">{{ comment.date | date: "%d %b %Y" }}</span>
</small>
</div>
<small class="text-sm font-action">
<a href="#" class="text-sm hover:underline">Reply Author 2</a>
<span class="text-text-muted text-sm opacity-75">12 Oct 2023</span>
</small>
</div>
</div>
{% endfor %}
</div>
</div>