wagtail-tw-blocks 0.3.0__py3-none-any.whl → 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. wagtail_blocks/__init__.py +6 -70
  2. wagtail_blocks/blocks.py +157 -536
  3. wagtail_blocks/constants.py +60 -0
  4. wagtail_blocks/static/wagtail_blocks/css/app.css +18 -2
  5. wagtail_blocks/static/wagtail_blocks/css/styles.css +2 -2
  6. wagtail_blocks/static/wagtail_blocks/package-lock.json +251 -420
  7. wagtail_blocks/static/wagtail_blocks/package.json +3 -3
  8. wagtail_blocks/templates/wagtail/blocks/accordion.html +21 -0
  9. wagtail_blocks/templates/wagtail/blocks/alert.html +12 -0
  10. wagtail_blocks/templates/wagtail/blocks/carousel.html +19 -0
  11. wagtail_blocks/templates/wagtail/blocks/code.html +32 -0
  12. wagtail_blocks/templates/{wagtail_blocks → wagtail}/blocks/diff.html +3 -3
  13. wagtail_blocks/templates/wagtail/blocks/document.html +65 -0
  14. wagtail_blocks/templates/wagtail/blocks/hover_gallery.html +11 -0
  15. wagtail_blocks/templates/wagtail/blocks/tabs.html +20 -0
  16. wagtail_blocks/templates/wagtail/components/breadcrumbs.html +12 -0
  17. wagtail_blocks/templates/wagtail/components/form.html +116 -0
  18. wagtail_blocks/templates/wagtail/components/languages.html +77 -0
  19. wagtail_blocks/templates/wagtail/components/messages.html +56 -0
  20. wagtail_blocks/templates/wagtail/components/next.html +22 -0
  21. wagtail_blocks/templates/wagtail/components/pagination.html +59 -0
  22. wagtail_blocks/templates/wagtail/components/prev.html +25 -0
  23. wagtail_blocks/templates/wagtail/components/prev_next.html +5 -0
  24. wagtail_blocks/templates/wagtail/components/themes.html +366 -0
  25. wagtail_blocks/templates/wagtail/components/tree.html +28 -0
  26. wagtail_blocks/templates/wagtail/styles.html +29 -0
  27. wagtail_tw_blocks-1.0.0.dist-info/METADATA +451 -0
  28. wagtail_tw_blocks-1.0.0.dist-info/RECORD +39 -0
  29. {wagtail_tw_blocks-0.3.0.dist-info → wagtail_tw_blocks-1.0.0.dist-info}/WHEEL +1 -1
  30. wagtail_blocks/templates/wagtail_blocks/blocks/accordion.html +0 -49
  31. wagtail_blocks/templates/wagtail_blocks/blocks/alert.html +0 -24
  32. wagtail_blocks/templates/wagtail_blocks/blocks/browser.html +0 -15
  33. wagtail_blocks/templates/wagtail_blocks/blocks/carousel.html +0 -64
  34. wagtail_blocks/templates/wagtail_blocks/blocks/code.html +0 -66
  35. wagtail_blocks/templates/wagtail_blocks/blocks/code_mockup.html +0 -20
  36. wagtail_blocks/templates/wagtail_blocks/blocks/fab.html +0 -43
  37. wagtail_blocks/templates/wagtail_blocks/blocks/hover_gallery.html +0 -18
  38. wagtail_blocks/templates/wagtail_blocks/blocks/image.html +0 -19
  39. wagtail_blocks/templates/wagtail_blocks/blocks/list.html +0 -56
  40. wagtail_blocks/templates/wagtail_blocks/blocks/phone.html +0 -11
  41. wagtail_blocks/templates/wagtail_blocks/blocks/steps.html +0 -12
  42. wagtail_blocks/templates/wagtail_blocks/blocks/tabs.html +0 -24
  43. wagtail_blocks/templates/wagtail_blocks/blocks/timeline.html +0 -30
  44. wagtail_blocks/templates/wagtail_blocks/blocks/toast.html +0 -9
  45. wagtail_blocks/templates/wagtail_blocks/blocks/window.html +0 -9
  46. wagtail_blocks/templates/wagtail_blocks/styles.html +0 -92
  47. wagtail_tw_blocks-0.3.0.dist-info/METADATA +0 -239
  48. wagtail_tw_blocks-0.3.0.dist-info/RECORD +0 -37
  49. {wagtail_tw_blocks-0.3.0.dist-info → wagtail_tw_blocks-1.0.0.dist-info}/licenses/LICENSE +0 -0
@@ -1,66 +0,0 @@
1
- {% load i18n %}
2
-
3
- <div class="my-4 not-prose">
4
- <div
5
- class="card card-sm lg:card-md 2xl:card-lg border border-base-300 bg-base-200"
6
- >
7
- {% if self.show_header %}
8
- <div class="flex items-center justify-between gap-4 p-2">
9
- {% if self.show_window_btns %}
10
- <div class="flex items-center gap-2">
11
- <div class="size-5 rounded-full bg-green-500"></div>
12
- <div class="size-5 rounded-full bg-yellow-500"></div>
13
- <div class="size-5 rounded-full bg-red-500"></div>
14
- </div>
15
- {% endif %}
16
-
17
- <div
18
- class="tooltip tooltip-bottom tooltip-primary"
19
- data-tip="{% trans 'File name' %}"
20
- >
21
- <span
22
- class="badge font-mono font-semibold badge-soft badge-sm badge-primary lg:badge-md"
23
- >
24
- <span class="sr-only">{% trans 'File name: ' %}</span>
25
- <span>{{ self.file_name }}</span>
26
- </span>
27
- </div>
28
-
29
- <div class="flex items-center justify-between gap-4">
30
- {% if self.show_language %}
31
- <div
32
- class="tooltip tooltip-left rtl:tooltip-right"
33
- data-tip="{% trans 'Programming language' %}"
34
- >
35
- <span class="btn btn-xs btn-copy btn-ghost lg:btn-sm">
36
- <i data-lucide="terminal" class="size-4 lg:size-5"></i>
37
- <span class="sr-only">{% trans 'Programming language' %}:</span>
38
- {{ self.language|title }}
39
- </span>
40
- </div>
41
- {% endif %}
42
-
43
- <!---->
44
- {% if self.show_copy_btn %}
45
- <div
46
- class="tooltip tooltip-left rtl:tooltip-right"
47
- data-tip="{% trans 'Copy' %}"
48
- >
49
- <button
50
- class="btn btn-xs btn-copy btn-ghost btn-square lg:btn-sm"
51
- data-clipboard-text="{{ self.code }}"
52
- >
53
- <span class="sr-only">{% trans 'Copy' %}</span>
54
- <i data-lucide="copy" class="size-4 lg:size-5"></i>
55
- </button>
56
- </div>
57
- {% endif %}
58
- </div>
59
- </div>
60
- {% endif %}
61
-
62
- <pre
63
- class="overflow-x-auto max-w-full rounded-box overflow-clip"
64
- ><code class="bg-transparent language-{{ self.language }}">{{ self.code }}</code></pre>
65
- </div>
66
- </div>
@@ -1,20 +0,0 @@
1
- {% load i18n %}
2
-
3
- <div class="my-4 not-prose">
4
- <div class="mockup-code w-full relative">
5
- <div class="absolute top-4 right-4">
6
- <div
7
- class="tooltip tooltip-left rtl:tooltip-right"
8
- data-tip="{% trans 'Programming language' %}"
9
- >
10
- <span class="btn btn-xs btn-copy btn-ghost lg:btn-sm">
11
- <i data-lucide="terminal" class="size-4 lg:size-5"></i>
12
- <span class="sr-only">{% trans 'Programming language' %}:</span>
13
- {{ self.language|title }}
14
- </span>
15
- </div>
16
- </div>
17
-
18
- <pre><code class="language-{{ self.language }}">{{ self.code }}</code></pre>
19
- </div>
20
- </div>
@@ -1,43 +0,0 @@
1
- {% load wagtailcore_tags %}
2
-
3
- <div class="fab items-center {% if self.is_flower %} fab-flower {% endif %}">
4
- <div
5
- tabindex="0"
6
- class="tooltip tooltip-left tooltip-{{ self.toggle.color }} rtl:tooltip-right"
7
- data-tip="{{ self.toggle.label }}"
8
- >
9
- <div
10
- role="button"
11
- class="btn btn-circle btn-sm btn-{{ self.toggle.color }} sm:btn-md lg:btn-lg xl:btn-xl"
12
- >
13
- <span class="sr-only">{{ self.toggle.label }}</span>
14
- <i data-lucide="{{ self.toggle.icon }}" class="size-4 lg:size-6"></i>
15
- </div>
16
- </div>
17
-
18
- {% if self.main %}
19
- <a
20
- href="{% if self.main.page %}{% pageurl self.main.page %}{% elif self.main.url %}{{ self.main.url }}{% else %}#{% endif %}"
21
- class="fab-main-action btn btn-circle btn-sm btn-{{ self.main.color }} sm:btn-md lg:btn-lg xl:btn-xl"
22
- >
23
- <span class="sr-only">{{ self.main.label }}</span>
24
- <i data-lucide="{{ self.main.icon }}" class="size-4 lg:size-6"></i>
25
- </a>
26
- {% endif %}
27
-
28
- <!---->
29
- {% for item in self.items %}
30
- <div
31
- class="tooltip tooltip-left tooltip-{{ item.color }} rtl:tooltip-right"
32
- data-tip="{{ item.label }}"
33
- >
34
- <a
35
- href="{% if item.page %}{% pageurl item.page %}{% elif item.url %}{{ item.url }}{% else %}#{% endif %}"
36
- class="btn btn-circle btn-xs btn-{{ item.color }} sm:btn-sm xl:btn-lg 2xl:btn-xl"
37
- >
38
- <span class="sr-only">{{ item.label }}</span>
39
- <i data-lucide="{{ item.icon }}" class="size-4 lg:size-6"></i>
40
- </a>
41
- </div>
42
- {% endfor %}
43
- </div>
@@ -1,18 +0,0 @@
1
- {% load wagtailimages_tags %}
2
-
3
- <div class="not-prose my-4">
4
- <ol class="hover-gallery">
5
- {% for item in self.items %}
6
- <li>
7
- <figure>
8
- {% image item.image fill-1920x1080 %}
9
-
10
- <!---->
11
- {% if item.caption %}
12
- <figcaption>{{ item.caption }}</figcaption>
13
- {% endif %}
14
- </figure>
15
- </li>
16
- {% endfor %}
17
- </ol>
18
- </div>
@@ -1,19 +0,0 @@
1
- {% load wagtailimages_tags %}
2
-
3
- <figure>
4
- {% image self.image fill-1920x1080 loading="lazy" %}
5
-
6
- <!---->
7
- {% if self.caption %}
8
- <figcaption class="text-xs md:text-sm xl:text-base">
9
- {{ self.caption }}
10
-
11
- <!---->
12
- {% if self.attribution %}
13
- <!---->
14
- - {{ self.attribution }}
15
- <!---->
16
- {% endif %}
17
- </figcaption>
18
- {% endif %}
19
- </figure>
@@ -1,56 +0,0 @@
1
- {% load i18n wagtailcore_tags wagtailimages_tags %}
2
-
3
- <div class="not-prose my-4">
4
- <ol class="list bg-base-100 rounded-box shadow-sm">
5
- <li
6
- role="heading"
7
- aria-level="1"
8
- class="p-4 pb-2 text-xs opacity-60 tracking-wide"
9
- >
10
- {{ self.title }}
11
- </li>
12
- {% for item in self.items %}
13
- <li class="list-row relative">
14
- {% if item.page %}
15
- <a href="{% pageurl item.page %}" class="absolute inset-0">
16
- <span class="sr-only">{% trans 'View' %}</span>
17
- </a>
18
- {% elif item.url %}
19
- <a href="{{ item.url }}" class="absolute inset-0">
20
- <span class="sr-only">{% trans 'View' %}</span>
21
- </a>
22
- {% endif %}
23
-
24
- <!---->
25
- {% if item.image %}
26
- <figure class="size-12 overflow-clip rounded-field">
27
- {% image item.image fill-1080x1080 %}
28
- </figure>
29
- {% endif %}
30
-
31
- <div>
32
- <h2>{{ item.title }}</h2>
33
-
34
- {% if item.description %}
35
- <p class="text-xs opacity-60">{{ item.description }}</p>
36
- {% endif %}
37
- </div>
38
-
39
- {% for action in item.actions %}
40
- <div
41
- class="tooltip tooltip-left tooltip-{{ action.color }} rtl:tooltip-right"
42
- data-tip="{{ action.title }}"
43
- >
44
- <a
45
- href="{% if action.page %}{% pageurl action.page %}{% elif action.url %}{{ action.url }}{% else %}#{% endif %}"
46
- class="btn btn-xs btn-square btn-{{ action.color }} md:btn-sm lg:btn-md"
47
- >
48
- <span class="sr-only">{{ action.title }}</span>
49
- <i data-lucide="{{ action.icon }}" class="size-4 lg:size-6"></i>
50
- </a>
51
- </div>
52
- {% endfor %}
53
- </li>
54
- {% endfor %}
55
- </ol>
56
- </div>
@@ -1,11 +0,0 @@
1
- {% load wagtailimages_tags %}
2
-
3
- <div class="flex items-center justify-center my-4 not-prose">
4
- <div class="mx-auto mockup-phone border-primary">
5
- {% if self.show_camera %}
6
- <div class="mockup-phone-camera"></div>
7
- {% endif %}
8
-
9
- <div class="mockup-phone-display">{% image self.wallpaper scale-100 %}</div>
10
- </div>
11
- </div>
@@ -1,12 +0,0 @@
1
- <div class="my-4 not-prose overflow-x-auto">
2
- <ol class="steps {% if self.is_vertical %} steps-vertical {% endif %}">
3
- {% for item in self.items %}
4
- <li class="step {% if item.color %}step-{{ item.color }}{% endif %}">
5
- <span class="step-icon">
6
- <i data-lucide="{{ item.icon }}" class="size-4 lg:size-6"></i>
7
- </span>
8
- {{ item.name }}
9
- </li>
10
- {% endfor %}
11
- </ol>
12
- </div>
@@ -1,24 +0,0 @@
1
- <div class="my-4 not-prose">
2
- <div
3
- class="tabs {% if self.is_reversed %} tabs-bottom {% endif %} tabs-xs tabs-{{ self.style }} sm:tabs-sm lg:tabs-md xl:tabs-lg 2xl:tabs-xl"
4
- >
5
- {% for item in self.items %}
6
- <input
7
- class="tab"
8
- type="radio"
9
- aria-label="{{ item.title }}"
10
- name="{{ self.name|slugify }}"
11
- {% if item.is_selected %}checked{% endif %}
12
- />
13
- <div
14
- class="tab-content bg-base-100 border-base-300 p-4 {% if self.style != 'lift' %} rounded-field {% endif %}"
15
- >
16
- <div
17
- class="prose mx-auto prose-sm xl:prose-lg 2xl:prose-xl prose-img:w-full prose-img:rounded-field"
18
- >
19
- {{ item.content }}
20
- </div>
21
- </div>
22
- {% endfor %}
23
- </div>
24
- </div>
@@ -1,30 +0,0 @@
1
- {% load wagtailcore_tags %}
2
-
3
- <div class="my-4 not-prose">
4
- <ol
5
- class="timeline {% if self.snap_to_icon %} timeline-snap-icon {% endif %}{% if self.is_compact %} timeline-compact {% endif %}{% if self.is_vertical %} timeline-vertical {% endif %}"
6
- >
7
- {% for item in self.items %}
8
- <li>
9
- {% if not forloop.first %}
10
- <hr class="bg-primary" />
11
- {% endif %}
12
-
13
- <time datetime="{{ item.date|date }}" class="timeline-start text-xs">
14
- {{ item.date|date }}
15
- </time>
16
- <div class="timeline-middle">
17
- <i
18
- data-lucide="{{ item.icon }}"
19
- class="size-4 text-primary lg:size-6"
20
- ></i>
21
- </div>
22
- <p class="timeline-end timeline-box">{{ item.content }}</p>
23
-
24
- {% if not forloop.last %}
25
- <hr class="bg-primary" />
26
- {% endif %}
27
- </li>
28
- {% endfor %}
29
- </ol>
30
- </div>
@@ -1,9 +0,0 @@
1
- {% load wagtailcore_tags %}
2
-
3
- <div class="not-prose my-4">
4
- <ol class="toast toast-end">
5
- {% for item in self.items %}
6
- <li>{% include_block item %}</li>
7
- {% endfor %}
8
- </ol>
9
- </div>
@@ -1,9 +0,0 @@
1
- {% load wagtailimages_tags %}
2
-
3
- <div class="my-4 not-prose">
4
- <div class="mockup-window bg-base-100 border border-base-300">
5
- <div class="grid place-content-center">
6
- {% image self.wallpaper fill-1920x1080 %}
7
- </div>
8
- </div>
9
- </div>
@@ -1,92 +0,0 @@
1
- <!-- Accordion styles -->
2
- <div class="collapse collapse-arrow"></div>
3
- <div class="collapse collapse-plus"></div>
4
-
5
- <!-- Alert styles -->
6
- <div class="alert alert-info"></div>
7
- <div class="alert alert-success"></div>
8
- <div class="alert alert-warning"></div>
9
- <div class="alert alert-info"></div>
10
- <!-- Soft -->
11
- <div class="alert alert-soft alert-info"></div>
12
- <div class="alert alert-soft alert-success"></div>
13
- <div class="alert alert-soft alert-warning"></div>
14
- <div class="alert alert-soft alert-info"></div>
15
- <!-- Outline -->
16
- <div class="alert alert-outline alert-info"></div>
17
- <div class="alert alert-outline alert-success"></div>
18
- <div class="alert alert-outline alert-warning"></div>
19
- <div class="alert alert-outline alert-info"></div>
20
- <!-- Dash -->
21
- <div class="alert alert-dash alert-info"></div>
22
- <div class="alert alert-dash alert-success"></div>
23
- <div class="alert alert-dash alert-warning"></div>
24
- <div class="alert alert-dash alert-info"></div>
25
-
26
- <!-- Buttons -->
27
- <button class="btn btn-primary"></button>
28
- <button class="btn btn-secondary"></button>
29
- <button class="btn btn-accent"></button>
30
- <button class="btn btn-info"></button>
31
- <button class="btn btn-success"></button>
32
- <button class="btn btn-warning"></button>
33
- <button class="btn btn-error"></button>
34
- <!-- Soft -->
35
- <button class="btn btn-soft btn-primary"></button>
36
- <button class="btn btn-soft btn-secondary"></button>
37
- <button class="btn btn-soft btn-accent"></button>
38
- <button class="btn btn-soft btn-info"></button>
39
- <button class="btn btn-soft btn-success"></button>
40
- <button class="btn btn-soft btn-warning"></button>
41
- <button class="btn btn-soft btn-error"></button>
42
- <!-- Outline -->
43
- <button class="btn btn-outline btn-primary"></button>
44
- <button class="btn btn-outline btn-secondary"></button>
45
- <button class="btn btn-outline btn-accent"></button>
46
- <button class="btn btn-outline btn-info"></button>
47
- <button class="btn btn-outline btn-success"></button>
48
- <button class="btn btn-outline btn-warning"></button>
49
- <button class="btn btn-outline btn-error"></button>
50
- <!-- Dash -->
51
- <button class="btn btn-dash btn-primary"></button>
52
- <button class="btn btn-dash btn-secondary"></button>
53
- <button class="btn btn-dash btn-accent"></button>
54
- <button class="btn btn-dash btn-info"></button>
55
- <button class="btn btn-dash btn-success"></button>
56
- <button class="btn btn-dash btn-warning"></button>
57
- <button class="btn btn-dash btn-error"></button>
58
- <!-- Ghost -->
59
- <button class="btn btn-ghost btn-primary"></button>
60
- <button class="btn btn-ghost btn-secondary"></button>
61
- <button class="btn btn-ghost btn-accent"></button>
62
- <button class="btn btn-ghost btn-info"></button>
63
- <button class="btn btn-ghost btn-success"></button>
64
- <button class="btn btn-ghost btn-warning"></button>
65
- <button class="btn btn-ghost btn-error"></button>
66
- <!-- Link -->
67
- <button class="btn btn-link btn-primary"></button>
68
- <button class="btn btn-link btn-secondary"></button>
69
- <button class="btn btn-link btn-accent"></button>
70
- <button class="btn btn-link btn-info"></button>
71
- <button class="btn btn-link btn-success"></button>
72
- <button class="btn btn-link btn-warning"></button>
73
- <button class="btn btn-link btn-error"></button>
74
- <!-- Shapes -->
75
- <button class="btn btn-wide"></button>
76
- <button class="btn btn-circle"></button>
77
- <button class="btn btn-square"></button>
78
- <button class="btn btn-block"></button>
79
-
80
- <!-- Tabs -->
81
- <div class="tabs tabs-border"></div>
82
- <div class="tabs tabs-box"></div>
83
- <div class="tabs tabs-lift"></div>
84
-
85
- <!-- Tooltips -->
86
- <button class="tooltip tooltip-primary"></button>
87
- <button class="tooltip tooltip-secondary"></button>
88
- <button class="tooltip tooltip-accent"></button>
89
- <button class="tooltip tooltip-info"></button>
90
- <button class="tooltip tooltip-success"></button>
91
- <button class="tooltip tooltip-warning"></button>
92
- <button class="tooltip tooltip-error"></button>
@@ -1,239 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: wagtail-tw-blocks
3
- Version: 0.3.0
4
- Summary: A collection of reusable, production-ready content blocks for Wagtail CMS, styled with Tailwind CSS and daisyUI.
5
- License: MIT
6
- License-File: LICENSE
7
- Author: Yousef Abu Shanab
8
- Author-email: josephyousef249@gmail.com
9
- Requires-Python: >=3.10
10
- Classifier: License :: OSI Approved :: MIT License
11
- Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
14
- Classifier: Programming Language :: Python :: 3.12
15
- Classifier: Programming Language :: Python :: 3.13
16
- Classifier: Programming Language :: Python :: 3.14
17
- Requires-Dist: django (>=5.2.1)
18
- Requires-Dist: wagtail (>=7.0)
19
- Project-URL: Documentation, https://github.com/youzarsiph/wagtail-tw-blocks
20
- Project-URL: Homepage, https://github.com/youzarsiph/wagtail-tw-blocks
21
- Project-URL: Repository, https://github.com/youzarsiph/wagtail-tw-blocks
22
- Description-Content-Type: text/markdown
23
-
24
- # wagtail-tw-blocks
25
-
26
- [![CI](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ci.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ci.yml)
27
- [![CD](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/cd.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/cd.yml)
28
- [![Code Style: Black](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/black.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/black.yml)
29
- [![Code Linting: Ruff](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ruff.yml/badge.svg)](https://github.com/youzarsiph/wagtail-tw-blocks/actions/workflows/ruff.yml)
30
- [![PyPI - Version](https://img.shields.io/pypi/v/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
31
- [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/wagtail-tw-blocks?logo=python&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
32
- [![PyPI - Downloads](https://img.shields.io/pypi/dm/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
33
- [![PyPI - License](https://img.shields.io/pypi/l/wagtail-tw-blocks?logo=pypi&logoColor=white)](https://pypi.org/project/wagtail-tw-blocks/)
34
-
35
- ## Overview
36
-
37
- **wagtail-tw-blocks** is a collection of reusable, production-ready content blocks for Wagtail CMS, styled with Tailwind CSS and daisyUI. It provides a set of common UI components—ready to drop into your `StreamField`—so you can build rich, modern page layouts without reinventing the wheel.
38
-
39
- ---
40
-
41
- ## Key features
42
-
43
- - **Modern design:** Tailwind CSS + daisyUI styling for clean, responsive layouts.
44
- - **Multiple themes:** All daisyUI themes included, with easy customization.
45
- - **CI/CD:** GitHub Actions pipelines for automated testing and deployment.
46
-
47
- ---
48
-
49
- ## Demo
50
-
51
- [![Demo](https://img.youtube.com/vi/0b0dZByyPok/maxresdefault.jpg)](https://youtu.be/0b0dZByyPok)
52
-
53
- ---
54
-
55
- ## Available blocks
56
-
57
- - **Accordion (Collapse):** Expandable/collapsible sections for FAQs or structured content.
58
- - **Alert:** Highlight important messages or status updates.
59
- - **Carousel:** Image or content slider with responsive design.
60
- - **Code:** Syntax-highlighted code snippets for technical content (Requires `highlight.js` and `clipboard.js` to be included in your page).
61
- - **Diff:** Side-by-side or inline difference highlighting for image comparisons.
62
- - **FAB:** Floating Action Button with multiple action items.
63
- - **Hover Gallery:** Image gallery with hover effects.
64
- - **List:** Ordered lists with custom styling.
65
- - **Steps:** Step-by-step process indicators.
66
- - **Tabs:** Tabbed content sections.
67
- - **Timeline:** Chronological event listings.
68
- - **Toast:** Temporary notification messages.
69
- - **Image:** Responsive images with optional captions.
70
- - **Browser Mockup:** Browser window frame for screenshots or web content.
71
- - **Phone Mockup:** Mobile phone frame for app screenshots or mobile content.
72
- - **Window Mockup:** Desktop window frame for application screenshots or desktop content.
73
-
74
- ---
75
-
76
- ## Installation
77
-
78
- ```bash
79
- pip install wagtail-tw-blocks
80
- ```
81
-
82
- ---
83
-
84
- ## Configuration
85
-
86
- Add `wagtail_blocks` to your `INSTALLED_APPS` **after** configuring your Wagtail settings:
87
-
88
- ```python
89
- # project/settings.py
90
-
91
- INSTALLED_APPS = [
92
- "wagtail_blocks",
93
- # ...
94
- ]
95
- ```
96
-
97
- ### Available settings
98
-
99
- You can customize the behavior of `wagtail-tw-blocks` by adding the following settings to your Django settings file:
100
-
101
- ```python
102
- # project/settings.py
103
-
104
- # Extend or override the default programming languages for the CodeBlock
105
- WB_CODE_BLOCK_PROGRAMMING_LANGUAGES = [
106
- ('python', 'Python'),
107
- ('javascript', 'JavaScript'),
108
- ('html', 'HTML'),
109
- ('css', 'CSS'),
110
- ('java', 'Java'),
111
- ('csharp', 'C#'),
112
- ('cpp', 'C++'),
113
- ('ruby', 'Ruby'),
114
- ('go', 'Go'),
115
- ('php', 'PHP'),
116
- # ...
117
- ]
118
-
119
- # Show or hide the header the CodeBlock
120
- WB_CODE_BLOCK_SHOW_HEADER = True # Default is True
121
-
122
- # Show or hide the programming language label in the CodeBlock
123
- WB_CODE_BLOCK_SHOW_PROGRAMMING_LANGUAGE = True # Default is True
124
-
125
- # Show or hide the copy button in the CodeBlock
126
- WB_CODE_BLOCK_SHOW_COPY_BUTTON = True # Default is True
127
-
128
- # Show or hide window control buttons in the CodeBlock
129
- WB_CODE_BLOCK_SHOW_WINDOW_CONTROLS = True # Default is True
130
- ```
131
-
132
- ---
133
-
134
- ## Usage example
135
-
136
- ```python
137
- # blog/models.py
138
-
139
- from wagtail_blocks import blocks
140
- from wagtail.admin.panels import FieldPanel
141
- from wagtail.fields import StreamField
142
- from wagtail.models import Page
143
- from django.utils.translation import gettext_lazy as _
144
-
145
-
146
- class Article(Page):
147
- content = StreamField(
148
- [
149
- ("accordion", blocks.AccordionBlock()),
150
- ("alert", blocks.AlertBlock()),
151
- ("carousel", blocks.CarouselBlock()),
152
- ("code", blocks.CodeBlock()),
153
- ("diff", blocks.DiffBlock()),
154
- # ...
155
- ],
156
- help_text=_("Article content"),
157
- )
158
-
159
- content_panels = Page.content_panels + [
160
- FieldPanel("content"),
161
- # ...
162
- ]
163
- ```
164
-
165
- ```html
166
- <!-- blog/base.html -->
167
- <!doctype html>
168
- <html>
169
- <head>
170
- <meta charset="UTF-8" />
171
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
172
- <title>Wagtail Blocks Usage Example</title>
173
-
174
- <!-- Code highlighting for CodeBlock -->
175
- <link
176
- rel="stylesheet"
177
- href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/styles/github-dark.min.css"
178
- />
179
- <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.1/highlight.min.js"></script>
180
- <script>hljs.highlightAll();</script>
181
-
182
- <!-- Include stylesheet -->
183
- {% load static %}
184
- <link href="{% static 'wagtail_blocks/css/styles.css' %}" rel="stylesheet" type="text/css" />
185
- </head>
186
-
187
- <body>
188
- <main>
189
- <h1>{{ article.title }}</h1>
190
-
191
- <div>{{ article.content }}</div>
192
- </main>
193
-
194
- <!-- Lucide icons: https://lucide.dev/icons/ -->
195
- <script src="https://unpkg.com/lucide@latest"></script>
196
- <script>lucide.createIcons();</script>
197
-
198
- <!-- For copy buttons in CodeBlock -->
199
- <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.11/clipboard.min.js"></script>
200
- <script>const btns = new ClipboardJS(".btn-copy");</script>
201
- </body>
202
- </html>
203
- ```
204
-
205
- ---
206
-
207
- ## Extending
208
-
209
- You can easily extend or customize the provided blocks by sub-classing them. For example, to create a custom alert block with additional styles:
210
-
211
- ```python
212
- from wagtail_blocks import blocks
213
-
214
- class CustomAlertBlock(blocks.AlertBlock):
215
-
216
- class Meta:
217
- template = "path/to/your/custom_alert_template.html"
218
- icon = "warning"
219
- label = "Custom Alert"
220
- ```
221
-
222
- ---
223
-
224
- ## Contributing
225
-
226
- We welcome community contributions. See the [CONTRIBUTING](CONTRIBUTING.md) guide for setup instructions, coding standards, and workflow. Opening an issue before major changes helps align on scope and direction.
227
-
228
- ---
229
-
230
- ## Support
231
-
232
- For questions, bug reports, or feature requests, open an issue or join the conversation in [GitHub Discussions](https://github.com/youzarsiph/wagtail-tw-blocks/discussions).
233
-
234
- ---
235
-
236
- ## License
237
-
238
- Licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
239
-