From 990ca322f38b4191356cb72ba61967f09c147d6a Mon Sep 17 00:00:00 2001 From: Samir Boulahtit Date: Sat, 6 Dec 2025 18:35:52 +0100 Subject: [PATCH] docs: add macros and pagination sections to components page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update admin components page with documentation for: - New Macros section listing all available shared macros with imports - Pagination section with live interactive examples - Copy-to-clipboard functionality for code snippets - Dark mode support for all new sections This serves as a living style guide for developers implementing new admin pages using the shared component library. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- app/templates/admin/components.html | 210 ++++++++++++++++++++++++++++ static/admin/js/components.js | 2 + 2 files changed, 212 insertions(+) diff --git a/app/templates/admin/components.html b/app/templates/admin/components.html index d257dcb1..abb50265 100644 --- a/app/templates/admin/components.html +++ b/app/templates/admin/components.html @@ -91,6 +91,216 @@ html {
+ +
+
+

+ + Jinja Macros +

+ +
+
+ +
+

+ Reusable Components: Use Jinja macros from shared/macros/ instead of copy-pasting HTML. This ensures consistency and makes updates easier. +

+
+
+
+ + +
+

Available Macro Files

+
+
+

pagination.html

+

Table pagination with page numbers

+ pagination(), pagination_simple() +
+
+

alerts.html

+

Alerts, loading states, toasts

+ loading_state(), error_state(), alert(), toast() +
+
+

badges.html

+

Status badges and indicators

+ badge(), status_badge(), verification_badge(), role_badge() +
+
+

buttons.html

+

Button variants and action buttons

+ btn_primary(), btn_secondary(), action_button() +
+
+

forms.html

+

Form inputs with validation

+ form_input(), form_select(), form_textarea() +
+
+

tables.html

+

Table components and empty states

+ table_wrapper(), table_header(), table_empty_state() +
+
+

cards.html

+

Stat cards and info cards

+ stat_card(), card(), info_card(), coming_soon_card() +
+
+

headers.html

+

Page headers and breadcrumbs

+ page_header(), section_header(), breadcrumbs() +
+
+
+ + +
+

Usage Example

+
+
{# Import at the top of your template #}
+{% raw %}{% from 'shared/macros/pagination.html' import pagination %}
+{% from 'shared/macros/alerts.html' import loading_state, error_state %}
+{% from 'shared/macros/badges.html' import status_badge, verification_badge %}
+{% from 'shared/macros/buttons.html' import btn_primary, action_button %}
+{% from 'shared/macros/cards.html' import stat_card %}
+{% from 'shared/macros/headers.html' import page_header %}
+
+{# Then use in your template #}
+{{ page_header('User Management', action_label='Create User', action_url='/users/create') }}
+
+{{ loading_state('Loading users...') }}
+{{ error_state('Error loading users') }}
+
+{# In your table #}
+{{ pagination() }}{% endraw %}
+
+ +
+
+
+ + +
+
+

+ + Pagination +

+ + +
+

Full Pagination (with page numbers)

+

+ Use the pagination() macro. Requires Alpine.js properties: pagination, startIndex, endIndex, totalPages, pageNumbers. +

+
+ +
+ + Showing 1-10 of 97 + + + + + +
+
+ +
+ + +
+

Simple Pagination (prev/next only)

+

+ Use pagination_simple() for a simpler prev/next navigation. +

+
+
+ + Showing 1-10 of 97 results + +
+ + Page 1 of 10 + +
+
+
+ +
+
+
+
diff --git a/static/admin/js/components.js b/static/admin/js/components.js index 53240e92..b82361ed 100644 --- a/static/admin/js/components.js +++ b/static/admin/js/components.js @@ -21,6 +21,8 @@ function adminComponents() { // Component sections sections: [ + { id: 'macros', name: 'Macros', icon: 'template' }, + { id: 'pagination', name: 'Pagination', icon: 'dots-horizontal' }, { id: 'forms', name: 'Forms', icon: 'clipboard-list' }, { id: 'buttons', name: 'Buttons', icon: 'cursor-click' }, { id: 'cards', name: 'Cards', icon: 'collection' },