tfcconnection-zola/templates/section.html

121 lines
5.6 KiB
HTML

{% extends "layout.html" %}
{% block content %}
<div class="flex items-center flex-col mt-10">
<h1 class="text-2xl text-bold mb-6">
{{ section.title }}
</h1>
<div class="p-4 mb-8 mx-8 [&>*]:py-4">
{{ section.content | safe }}
</div>
<div class="flex flex-col gap-y-6 w-full px-4 sm:w-2/3">
{% if paginator %}
{{ paginator }}
{% set pages = paginator.pages %}
{% else %}
{% if section.subsections %}
{% set pages = section.subsections %}
{% set subs = section.subsections %}
{% else %}
{% set pages = section.pages %}
{% endif %}
{% endif %}
{% for page in pages %}
{% if subs %}
{% set page = get_section(path=page) %}
{% endif %}
{% if page.extra.image %}
{% set image = page.path ~ page.extra.image %}
{% endif %}
{% if image %}
{% set resized = resize_image(path="/content" ~ image, width=200, height=200, op="fit_height") %}
{% else %}
{% set resized = "" %}
{% endif %}
<div class="flex flex-wrap space-x-4 border border-2 border-gray-200 dark:border-black rounded-xl p-5 shadow-xl hover:shadow-xl/30 transform transition duration-500 hover:scale-105 bg-gray-200 dark:bg-gray-800 place-content-center cursor-pointer" onclick='location.href="{{ page.permalink }}";'>
<!-- Image -->
{% if resized %}
<div class="flex-1 rounded-lg place-content-center">
<img class="rounded-lg" src="{{ resized.url }}"/>
</div>
{% else %}
{% endif %}
<div class="flex flex-col flex-3">
<h2 class="text-2xl text-bold"><a href='{{ page.permalink }}'>{{ page.title }}</a></h2>
<p class="text-bold text-ellipsis">{{ page.description | linebreaksbr | safe }}</p>
<!-- Summary -->
<div class="text-bold mt-8">
<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>
</div>
</div>
{% endfor %}
</div>
</div>
{% endblock content %}
{% 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">
{% 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>
Previous
</span>
{% else %}
<!-- Active -->
<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 %}>
<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 %}
<ul class="flex gap-x-2">
{% for pager in range(start=1, end=paginator.number_pagers+1) %}
<li class="">
<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}}">
{{pager}}
</a>
</li>
{% endfor %}
</ul>
{% 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 -->
<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 }}">
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 %}
</div>
</div>
{% endif %}
{% endblock %}