|
| 1 | +{% load unfold %} |
| 2 | + |
| 3 | +<li class="border rounded-default select-none |
| 4 | + {% if action.variant.value == "primary" %}border-primary-700 bg-primary-600 text-white dark:border-primary-500 |
| 5 | + {% elif action.variant.value == "danger" %}border-red-700 bg-red-600 text-white dark:border-red-500 |
| 6 | + {% elif action.variant.value == "success" %}border-green-700 bg-green-600 text-white dark:border-green-500 |
| 7 | + {% elif action.variant.value == "info" %}border-blue-700 bg-blue-600 text-white dark:border-blue-500 |
| 8 | + {% elif action.variant.value == "warning" %}border-orange-700 bg-orange-600 text-white dark:border-orange-500 |
| 9 | + {% else %}border-base-200 dark:border-base-700 hover:text-primary-600 dark:hover:text-primary-500 |
| 10 | + {% endif %}" |
| 11 | + {% if not link and action.items|length > 0 %}x-data="{actionDropdownOpen: false}" x-ref="actionDropdown{{ action.method_name }}"{% endif %}> |
| 12 | + <a {% if link %}href="{{ link }}"{% endif %}class="cursor-pointer flex grow items-center gap-2 px-3 py-2 text-left whitespace-nowrap" {% if blank %} target="_blank"{% endif %} {% include "unfold/helpers/attrs.html" with attrs=action.attrs %} |
| 13 | + {% if not link %} |
| 14 | + x-on:click="actionDropdownOpen = !actionDropdownOpen" |
| 15 | + x-bind:class="{'{% if action.variant.value == "default" %}text-primary-600 dark:text-primary-500{% endif %}': actionDropdownOpen }" |
| 16 | + {% endif %}> |
| 17 | + |
| 18 | + {% if action.icon %} |
| 19 | + <span class="material-symbols-outlined"> |
| 20 | + {{ action.icon }} |
| 21 | + </span> |
| 22 | + {% elif icon %} |
| 23 | + <span class="material-symbols-outlined"> |
| 24 | + {{ icon }} |
| 25 | + </span> |
| 26 | + {% endif %} |
| 27 | + |
| 28 | + {{ title }} |
| 29 | + |
| 30 | + {% if not link and action.items|length > 0 %} |
| 31 | + <span class="border-l border-base-200 flex items-center select-none self-stretch ml-auto -mr-1 !ml-1 pl-2 |
| 32 | + {% if action.variant.value == "primary" %}border-primary-700 dark:border-primary-500 |
| 33 | + {% elif action.variant.value == "danger" %}border-red-700 dark:border-red-500 |
| 34 | + {% elif action.variant.value == "success" %}border-green-700 dark:border-green-500 |
| 35 | + {% elif action.variant.value == "info" %}border-blue-700 dark:border-blue-500 |
| 36 | + {% elif action.variant.value == "warning" %}border-orange-700 dark:border-orange-500 |
| 37 | + {% else %}border-base-200 dark:border-base-700 |
| 38 | + {% endif %}"> |
| 39 | + <span class="material-symbols-outlined ml-auto rotate-90 transition-transform" x-bind:class="{'-rotate-90!': actionDropdownOpen }"> |
| 40 | + chevron_right |
| 41 | + </span> |
| 42 | + </span> |
| 43 | + {% endif %} |
| 44 | + </a> |
| 45 | + |
| 46 | + {% if not link and action.items|length > 0 %} |
| 47 | + <template x-teleport="body"> |
| 48 | + <nav x-anchor.bottom-end.offset.4="$refs.actionDropdown{{ action.method_name }}" class="absolute bg-white border border-base-200 flex flex-col -mr-px py-1 right-0 rounded-default shadow-lg top-10 w-52 z-50 dark:bg-base-800 dark:border-base-700" x-transition x-show="actionDropdownOpen" x-on:click.outside="actionDropdownOpen = false"> |
| 49 | + {% for item in action.items %} |
| 50 | + <a href="{{ item.path }}" class="flex items-center font-normal gap-2 max-h-[30px] mx-1 px-3 py-2 rounded-default text-left hover:bg-base-100 hover:text-base-700 dark:hover:bg-base-700 dark:hover:text-base-200 |
| 51 | + {% if item.variant.value == "danger" %}text-red-700 dark:text-red-400 hover:text-red-700 dark:hover:text-red-400 hover:bg-red-100 dark:hover:bg-red-500/20 |
| 52 | + {% elif item.variant.value == "warning" %}text-orange-700 dark:text-orange-400 hover:text-orange-700 dark:hover:text-orange-400 hover:bg-orange-100 dark:hover:bg-orange-500/20 |
| 53 | + {% elif item.variant.value == "success" %}text-green-700 dark:text-green-400 hover:text-green-700 dark:hover:text-green-400 hover:bg-green-100 dark:hover:bg-green-500/20 |
| 54 | + {% elif item.variant.value == "info" %}text-blue-500 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-500/20 |
| 55 | + {% elif item.variant.value == "primary" %}text-primary-700 dark:text-primary-400 hover:text-primary-700 dark:hover:text-primary-400 hover:bg-primary-100 dark:hover:bg-primary-500/20 |
| 56 | + {% else %}hover:bg-base-100 dark:hover:bg-base-700/20 |
| 57 | + {% endif %}" |
| 58 | + {% if blank %} target="_blank"{% endif %} {% include "unfold/helpers/attrs.html" with attrs=item.attrs %}> |
| 59 | + {% if item.icon %} |
| 60 | + <span class="material-symbols-outlined"> |
| 61 | + {{ item.icon }} |
| 62 | + </span> |
| 63 | + {% endif %} |
| 64 | + |
| 65 | + <span class="grow truncate" title="{{ item.title }}"> |
| 66 | + {{ item.title }} |
| 67 | + </span> |
| 68 | + </a> |
| 69 | + {% endfor %} |
| 70 | + </nav> |
| 71 | + </template> |
| 72 | + {% endif %} |
| 73 | +</li> |
0 commit comments