create infinite
This commit is contained in:
parent
54b3c4bc9b
commit
7bff037b78
14 changed files with 419 additions and 4 deletions
54
templates/app.css
Normal file
54
templates/app.css
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
|
||||
.spinner.htmx-request {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.spinner {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
height: 1rem;
|
||||
width: 1rem;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
border-radius: 0.25rem;
|
||||
border-radius: 9999px;
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: #450a0a;
|
||||
}
|
||||
|
||||
body::-webkit-scrollbar-track {
|
||||
border-radius: 0.25rem;
|
||||
border-radius: 9999px;
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: #450a0a;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 0.25rem;
|
||||
border-radius: 9999px;
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgba(239,68,68,var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: #f87171;
|
||||
background-color: #dc2626
|
||||
}
|
||||
|
||||
body::-webkit-scrollbar-thumb {
|
||||
border-radius: 0.25rem;
|
||||
border-radius: 9999px;
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgba(239,68,68,var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
body::-webkit-scrollbar-thumb:hover {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: #f87171;
|
||||
background-color: #dc2626
|
||||
}
|
||||
|
||||
33
templates/base.html
Normal file
33
templates/base.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
{% block head %}
|
||||
<title>
|
||||
{% block title %}HTMX Patterns{% endblock %}
|
||||
</title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link rel="icon" type="image/x-icon" href="{{ url_for('favicon') }}" />
|
||||
<link href="{{ url_for('app_css') }}" rel="stylesheet" />
|
||||
<script src="{{ url_for('htmx') }}"></script>
|
||||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body
|
||||
class="justify-center items-center min-h-screen bg-gray-900 bg-no-repeat bg-cover bg-gradient-to-b from-pink-950/50 min-w-screen text-shadow-xl text-shadow-zinc-950">
|
||||
<div id="grit"
|
||||
class="absolute top-0 right-0 bottom-0 left-0 justify-center items-center min-w-full bg-repeat bg-cover" style="background-image: url(https://fokais.com/grit.svg), url(https://fokais.com/grit-light.svg);
|
||||
pointer-events: none"></div>
|
||||
<div id="content" class="flex flex-col items-center min-h-screen min-w-screen text-white">
|
||||
{% if DEBUG %}
|
||||
{{ hot_reload.script(url_for('hot-reload') ) | safe }}
|
||||
{% endif %}
|
||||
{% block content %}
|
||||
{{ body | safe }}
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
templates/favicon.ico
Executable file
BIN
templates/favicon.ico
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
1
templates/htmx.js
Normal file
1
templates/htmx.js
Normal file
File diff suppressed because one or more lines are too long
12
templates/index.html
Normal file
12
templates/index.html
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1 id="title"
|
||||
class="inline-block pb-0 mx-auto mb-0 text-8xl font-black leading-tight leading-loose text-transparent bg-clip-text bg-gradient-to-r from-red-600 via-pink-500 to-yellow-400 ring-red-500 text-shadow-xl text-shadow-zinc-950 ring-5">
|
||||
HTMX PATTERNS
|
||||
</h1>
|
||||
|
||||
<p class='mt-0 mb-16 max-w-xl text-center prose-xl'>
|
||||
A collection of HTMX patterns
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
20
templates/infinite/persons.html
Normal file
20
templates/infinite/persons.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
<h1 id="title"
|
||||
class="inline-block pb-0 mx-auto mt-8 mb-0 text-6xl font-black leading-tight leading-loose text-transparent bg-clip-text bg-gradient-to-r from-red-600 via-pink-500 to-yellow-400 ring-red-500 text-shadow-xl text-shadow-zinc-950 ring-5">
|
||||
HTMX PATTERNS - INFINITE
|
||||
</h1>
|
||||
|
||||
<p class='text-3xl font-bold mt-0 mb-16 max-w-xl text-center prose-xl'>
|
||||
Contacts List
|
||||
</p>
|
||||
|
||||
<ul id="persons" class="flex flex-col gap-4 mb-16">
|
||||
{% include "infinite/persons_partial.html" %}
|
||||
</ul>
|
||||
|
||||
<div id='persons-loading' class='spinner mb-24 animate-bounce'>
|
||||
loading more contacts
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
16
templates/infinite/persons_partial.html
Normal file
16
templates/infinite/persons_partial.html
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{% for person in persons %}
|
||||
{% if loop.last %}
|
||||
<li hx-get="/infinite/persons?page={{ next_page }}" hx-trigger="intersect once" hx-target="#persons" hx-swap='beforeend'
|
||||
hx-indicator="#persons-loading"
|
||||
class="cursor-pointer bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded">
|
||||
|
||||
{{ person.name }} -
|
||||
{{ person.phone_number }}
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="cursor-pointer bg-red-500 hover:bg-red-600 text-white font-bold py-2 px-4 rounded">
|
||||
{{ person.name }} -
|
||||
{{ person.phone_number }}
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue