Files
project-behind-the-desk/_includes/post_list.liquid
T

102 lines
6.1 KiB
Plaintext

<!-- Quick Tips Box -->
<div class="bg-rules-bg p-4 rounded mb-4 text-primary">
<p><strong>Quick Tips:</strong> Keep it brief, keep it real. Share your desk moments, finds, or frustrations. Upvote what resonates!</p>
</div>
{% assign filter_type = page.filter_type | default: 'all' %}
{% assign sort_by = page.sort_by | default: 'new' %}
<!-- Filter and Sort Controls -->
<div class="mb-6 pb-4 bg-gray-100 rounded-md">
<div class="flex flex-col sm:flex-row justify-between space-y-4 sm:space-y-0">
<!-- Filter by Type -->
<div class="filter-controls flex flex-col space-y-3 sm:flex-row sm:space-y-0 sm:space-x-2 sm:items-center">
<a href="/" class="filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 {% if filter_type == 'all' %}border-primary bg-primary/10{% else %}border-gray-300{% endif %} rounded-md hover:border-primary transition-colors">
<i class="fas fa-list fa-fw text-primary"></i>
<span class="text-sm font-action font-medium text-primary">All</span>
</a>
<a href="/win/" class="filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 {% if filter_type == 'win' %}border-primary bg-primary/10{% else %}border-gray-300{% endif %} rounded-md hover:border-primary transition-colors">
<img src="/assets/images/icon_win.png" alt="Win" class="w-5 h-5 object-contain inline-block">
<span class="text-sm font-action font-medium text-primary">Wins</span>
</a>
<a href="/frustration/" class="filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 {% if filter_type == 'frustration' %}border-primary bg-primary/10{% else %}border-gray-300{% endif %} rounded-md hover:border-primary transition-colors">
<img src="/assets/images/icon_frustrated.png" alt="Frustration" class="w-5 h-5 object-contain inline-block">
<span class="text-sm font-action font-medium text-primary">Frustrations</span>
</a>
<a href="/weird/" class="filter-btn w-full sm:w-auto flex items-center justify-center space-x-2 p-3 border-2 {% if filter_type == 'weird' %}border-primary bg-primary/10{% else %}border-gray-300{% endif %} rounded-md hover:border-primary transition-colors">
<img src="/assets/images/icon_weird.png" alt="Weird" class="w-5 h-5 object-contain inline-block">
<span class="text-sm font-action font-medium text-primary">Weird</span>
</a>
</div>
<!-- Sort Dropdown (optional, static default) -->
<div class="sort-controls flex items-center space-x-2">
<label for="sort-select" class="text-sm font-medium text-gray-700">Sort by:</label>
<select id="sort-select" disabled class="cursor-not-allowed text-sm font-action bg-white border border-gray-300 rounded-md px-3 py-1.5">
<option selected>Newest</option>
</select>
</div>
</div>
</div>
<!-- Post List -->
<div id="post-list-container" class="post-list space-y-4">
{% assign posts = site.posts %}
{% if filter_type != 'all' %}
{% assign posts = posts | where: 'type', filter_type %}
{% endif %}
{% assign posts = posts | sort: 'date' | reverse %}
{% if posts == empty %}
<div class="text-center text-gray-500 font-action py-10">
<p>No results found for this filter.</p>
</div>
{% else %}
{% for post in posts %}
<div class="post-item mb-4">
<article class="flex flex-col md:flex-row items-start">
<div class="flex-1 text-left">
<!-- Post Title -->
<div class="flex items-center space-x-2 mb-0.5">
<p class="mt-0 mb-0">
<strong>
<a href="{{ post.url }}" class="text-text-title font-bold text-md md:text-sm hover:underline">
{{ post.title }}
</a>
</strong>
</p>
</div>
<!-- Post Metadata -->
<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">
<i class="fa-solid fa-arrow-up mr-1"></i> {{ post.upvotes }}
</span>
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center">
<a href="/reply/"><i class="fas fa-reply mr-1"></i> REPLY</a>
</span>
<span class="bg-gray-200 text-gray-700 text-xs font-action px-4 py-2 rounded-full flex items-center">
<i class="fas fa-comment mr-1"></i> {{ post.comments_count }}
</span>
</div>
<small class="text-sm font-action">
<a href="/user/" class="text-sm hover:underline">{{ post.author }}</a>
<span class="text-text-muted text-sm opacity-75">{{ post.date | date: "%d %b %Y" }}</span>
</small>
</div>
</div>
</article>
<hr class="border-border-light my-4">
</div>
{% endfor %}
{% endif %}
</div>
<!-- More Button -->
<div class="pt-2">
<button type="submit" class="w-full md:w-auto px-6 py-3 bg-primary text-white text-sm font-medium rounded-md hover:bg-primary-dark focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary transition duration-150 ease-in-out font-monda font-action">More</button>
</div>