Skip to content

Python module for JinjaX component? #91

Answered by jpsca
duxnp asked this question in Q&A
Discussion options

You must be logged in to vote

The current way to do it is inside the template which, I have to admit, can be very cumbersome.
For example:

Badge.jinja

{#def color="gray", href=None #}

{% if color == "green" %}
  {% do attrs.set(
    class="bg-green-100 border-green-200 text-green-600" + (" hover:bg-green-200" if href else "")
  ) %}
{% elif color == "red" %}
  {% do attrs.set(
    class="bg-red-100 border-red-200 text-red-600" + (" hover:bg-red-200" if href else "")
  ) %}
{% elif color == "yellow" %}
  {% do attrs.set(
    class="bg-yellow-100 border-yellow-200 text-yellow-600" + (" hover:bg-yellow-200" if href else "")
  ) %}
{% elif color == "blue" %}
  {% do attrs.set(
    class="bg-blue-100 border-blue-200 text-…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by jpsca
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants