blow/templates/section.html

112 lines
5.7 KiB
HTML
Raw Normal View History

2021-11-11 17:57:57 +00:00
{% extends "layout.html" %}
{% block content %}
<div class="flex items-center flex-col md:mt-10">
<h1 class="text-2xl text-bold mb-6">
2021-11-11 18:03:09 +00:00
{{ section.title }}
2021-11-11 17:57:57 +00:00
</h1>
<div class="flex flex-col gap-y-6 w-2/3">
{% if paginator %}
{% set pages = paginator.pages %}
{% else %}
2021-11-11 18:03:09 +00:00
{% set pages = section.pages %}
2021-11-11 17:57:57 +00:00
{% endif %}
2021-11-12 21:55:52 +00:00
{% for page in pages %}
<div class="border border-2 border-gray-200 dark:border-black rounded-xl p-5 shadow-2xl transform transition duration-500 hover:scale-105 bg-gray-200 dark:bg-gray-800">
<div class="flex flex-col py-2 justify-center">
2021-11-13 21:57:22 +00:00
<h2 class="text-2xl text-bold"><a href='{{ page.permalink }}'>{{ page.title }}</a></h2>
2021-11-12 21:55:52 +00:00
<p class="text-bold">{{ page.description }}</p>
</div>
2021-11-11 17:57:57 +00:00
2021-11-12 21:55:52 +00:00
<!-- Read time and word count -->
<div class="flex flex-wrap py-2">
<div class="flex items-center w-1/3">
<div class="flex space-x-3 text-gray-900 dark:text-gray-400">
<span class="flex">
<!-- Icon clock -->
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<span class="ml-1">{{ page.reading_time }} min</span>
</span>
<span class="flex">
<!-- Icon pencil -->
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15.232 5.232l3.536 3.536m-2.036-5.036a2.5 2.5 0 113.536 3.536L6.5 21.036H3v-3.572L16.732 3.732z"></path>
</svg>
<span class="ml-1">{{ page.word_count }} words</span>
</span>
</div>
2021-11-11 17:57:57 +00:00
</div>
</div>
2021-11-12 21:55:52 +00:00
<!-- Summary -->
<div class="text-bold mt-2">
{{ page.summary | safe }}
<a class="flex py-2" href='{{ page.permalink }}'>
Read More
<svg class="w-6 h-6 ml-1" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 5l7 7m0 0l-7 7m7-7H3"></path>
</svg>
</a>
</div>
2021-11-11 17:57:57 +00:00
</div>
2021-11-12 21:55:52 +00:00
{% endfor %}
2021-11-11 17:57:57 +00:00
</div>
</div>
{% endblock content %}
2021-11-11 22:03:45 +00:00
{% block pagination %}
{% if paginator.previous or paginator.next %}
<div class="max-w-7xl px-2 sm:px-6 lg:px-8 mx-auto w-full">
<div class="flex items-center justify-between">
2021-11-11 22:31:49 +00:00
{% if not paginator.previous %}
<!-- Disabled -->
<span class="flex items-center border border-gray-400 dark:border-black rounded-lg px-3 py-4 bg-gray-400 text-gray-200">
<svg class="w-7 h-7 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16l-4-4m0 0l4-4m-4 4h18"></path>
</svg>
2021-11-11 22:03:45 +00:00
Previous
2021-11-11 22:31:49 +00:00
</span>
{% else %}
<!-- Active -->
2021-11-11 22:44:28 +00:00
<a class="flex items-center border border-gray-400 dark:border-black rounded-lg text-gray-800 dark:text-gray-300 dark:bg-gray-800 hover:bg-gray-300 dark:hover:bg-gray-600 dark:hover:text-white px-3 py-4 rounded-md text-sm font-medium transform transition duration-500 hover:scale-105 bg-gray-200 dark:bg-gray-800" href="{{ paginator.previous }}" {% if not paginator.previous %}disabled{% endif %}>
2021-11-11 22:31:49 +00:00
<svg class="w-7 h-7 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16l-4-4m0 0l4-4m-4 4h18"></path>
</svg>
Previous
</a>
{% endif %}
2021-11-11 22:03:45 +00:00
<ul class="flex gap-x-2">
{% for pager in range(start=1, end=paginator.number_pagers+1) %}
<li class="">
2021-11-11 22:44:28 +00:00
<a class="p-4 border border-gray-400 dark:border-black rounded-lg text-gray-800 dark:text-gray-300 hover:bg-gray-300 dark:hover:bg-gray-600 hover:text-white rounded-md text-sm font-medium transform transition duration-500 hover:scale-105 {% if paginator.current_index == pager %}bg-blue-500{% else %}bg-gray-200 dark:bg-gray-800{% endif %}" href="{{ paginator.base_url }}{{pager}}" aria-label="Page {{pager}}">
2021-11-11 22:03:45 +00:00
{{pager}}
</a>
</li>
{% endfor %}
</ul>
2021-11-11 22:31:49 +00:00
{% if not paginator.next %}
<!-- Disabled -->
<span class="flex items-center border border-gray-400 dark:border-black rounded-lg px-3 py-4 bg-gray-400 text-gray-200">
Next Page
<svg class="w-7 h-7 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path>
</svg>
</span>
{% else %}
<!-- Active -->
2021-11-11 22:44:28 +00:00
<a class="flex items-center border border-gray-400 dark:border-black rounded-lg text-gray-800 dark:text-gray-300 dark:bg-gray-800 hover:bg-gray-300 dark:hover:bg-gray-600 dark:hover:text-white px-3 py-4 rounded-md text-sm font-medium transform transition duration-500 hover:scale-105 bg-gray-200 dark:bg-gray-800" href="{{ paginator.next }}">
2021-11-11 22:31:49 +00:00
Next page
<svg class="w-7 h-7 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 8l4 4m0 0l-4 4m4-4H3"></path>
</svg>
</a>
{% endif %}
2021-11-11 22:03:45 +00:00
</div>
</div>
{% endif %}
2021-11-11 22:31:49 +00:00
{% endblock %}