pagination.html

pagination.html for Thesis 2
 avatar
unknown
html
17 days ago
2.8 kB
5
Indexable
{# CSS Styles #}
<style>
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: white;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pagination-button {
    min-width: 32px;
    height: 32px;
    padding: 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #333;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    text-decoration: none;
    border: none;
    gap: 8px;
}

.pagination-number {
    min-width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: white;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    border-radius: 8px;
}

.pagination-number.current {
    border: 1px solid #333;
    border-radius: 8px;
}

.pagination-button:hover,
.pagination-number:hover {
    background-color: #f8f9fa;
    border-radius: 8px;
}

.pagination-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    color: #999;
    background: none;
}

.current-page {
    display: none;
}

.pagination-arrow {
    font-size: 20px;
}
</style>

{# HTML Content #}
<div class="pagination-container">
    <a href="javascript:void(0);" 
       class="pagination-button {% if current_page <= 1 %}disabled{% endif %}"
       onclick="loadPage({{ current_page - 1 if current_page > 1 else 1 }})"
       {% if current_page <= 1 %}disabled{% endif %}>
        <span class="pagination-arrow">‹</span> <span>Prev</span>
    </a>

    <nav class="pagination" role="navigation" aria-label="Pagination Navigation">
        {% for page in range(1, total_pages + 1) %}
            <a href="javascript:void(0);"
               class="pagination-number {% if page == current_page %}current{% endif %}"
               onclick="loadPage({{ page }})"
               aria-label="Page {{ page }}"
               {% if page == current_page %}aria-current="page"{% endif %}>
                {{ page }}
            </a>
        {% endfor %}
    </nav>

    <a href="javascript:void(0);" 
       class="pagination-button {% if current_page >= total_pages %}disabled{% endif %}"
       onclick="loadPage({{ current_page + 1 if current_page < total_pages else total_pages }})"
       {% if current_page >= total_pages %}disabled{% endif %}>
        <span>Next</span> <span class="pagination-arrow">›</span>
    </a>
</div>
Editor is loading...
Leave a Comment