fix: styling

This commit is contained in:
2024-11-27 18:12:50 +01:00
parent d16d194ae4
commit 254566eb8b
2 changed files with 39 additions and 31 deletions
+37 -30
View File
@@ -29,8 +29,7 @@
<div id="myCartDropdown1" <div id="myCartDropdown1"
class="absolute top-10 hidden z-10 mx-auto max-w-sm space-y-4 overflow-hidden rounded-lg bg-white p-4 antialiased shadow-lg dark:bg-gray-800"> class="absolute top-10 hidden z-10 mx-auto max-w-sm space-y-4 overflow-hidden rounded-lg bg-white p-4 antialiased shadow-lg dark:bg-gray-800">
<div class="grid grid-cols-2"> <div>
{% if cart.items.count == 0 %} {% if cart.items.count == 0 %}
<h2 class="text-sm font-medium text-gray-900 dark:text-white">No hay nada en el carrito</h2> <h2 class="text-sm font-medium text-gray-900 dark:text-white">No hay nada en el carrito</h2>
{% endif %} {% endif %}
@@ -38,40 +37,48 @@
{% for cart_item in cart.items.all %} {% for cart_item in cart.items.all %}
<div> <div>
<a href="#" <a href="#"
class="truncate text-sm font-semibold leading-none text-gray-900 dark:text-white hover:underline">{{ cart_item.product.name }}</a> class="truncate text-sm font-semibold leading-none text-gray-900 dark:text-white hover:underline">
<p {{ cart_item.product.name }}
class="mt-0.5 truncate text-sm font-normal text-gray-500 dark:text-gray-400">{{ cart_item.product.price.price_with_tax }}</p> </a>
</div>
<div class="flex items-center justify-end gap-6"> <div class="flex items-center justify-between gap-6">
<p <p
class="text-sm font-normal leading-none text-gray-500 dark:text-gray-400">{% translate 'Cantidad' %}: {{ cart_item.quantity }}</p> class="mt-0.5 truncate text-sm font-normal text-gray-500 dark:text-gray-400">
{{ cart_item.product.price.price_with_tax }}€
</p>
<form hx-post="{% url 'web:delete_cart_item' pk=cart_item.pk %}"
hx-swap="none">
<button data-tooltip-target="tooltipRemoveItem1a" type="submit" <form hx-post="{% url 'web:delete_cart_item' pk=cart_item.pk %}"
class="text-red-600 hover:text-red-700 dark:text-red-500 dark:hover:text-red-600" hx-swap="none">
<span class="mt-0.5 truncate text-sm font-normal text-gray-500 dark:text-gray-400 mr-2">
{% translate 'Cantidad' %}: {{ cart_item.quantity }}
</span>
<button data-tooltip-target="tooltipRemoveItem1a" type="submit"
class="text-red-600 hover:text-red-700 dark:text-red-500 dark:hover:text-red-600"
>
{% csrf_token %}
<span class="sr-only">{% translate 'Quitar' %}</span>
<svg class="h-4 w-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor"
viewBox="0 0 24 24">
<path fill-rule="evenodd"
d="M2 12a10 10 0 1 1 20 0 10 10 0 0 1-20 0Zm7.7-3.7a1 1 0 0 0-1.4 1.4l2.3 2.3-2.3 2.3a1 1 0 1 0 1.4 1.4l2.3-2.3 2.3 2.3a1 1 0 0 0 1.4-1.4L13.4 12l2.3-2.3a1 1 0 0 0-1.4-1.4L12 10.6 9.7 8.3Z"
clip-rule="evenodd"/>
</svg>
</button>
</form>
<div id="tooltipRemoveItem1a" role="tooltip"
class="tooltip invisible absolute z-10 inline-block rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium
text-white opacity-0 shadow-sm transition-opacity duration-300 dark:bg-gray-700"
> >
{% csrf_token %} {% translate 'Quitar del carrito' %}
<span class="sr-only">{% translate 'Quitar' %}</span> <div class="tooltip-arrow" data-popper-arrow></div>
<svg class="h-4 w-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" </div>
viewBox="0 0 24 24">
<path fill-rule="evenodd"
d="M2 12a10 10 0 1 1 20 0 10 10 0 0 1-20 0Zm7.7-3.7a1 1 0 0 0-1.4 1.4l2.3 2.3-2.3 2.3a1 1 0 1 0 1.4 1.4l2.3-2.3 2.3 2.3a1 1 0 0 0 1.4-1.4L13.4 12l2.3-2.3a1 1 0 0 0-1.4-1.4L12 10.6 9.7 8.3Z"
clip-rule="evenodd"/>
</svg>
</button>
</form>
<div id="tooltipRemoveItem1a" role="tooltip"
class="tooltip invisible absolute z-10 inline-block rounded-lg bg-gray-900 px-3 py-2 text-sm font-medium text-white opacity-0 shadow-sm transition-opacity duration-300 dark:bg-gray-700"
>
Remove item
<div class="tooltip-arrow" data-popper-arrow></div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}
</div> </div>
+2 -1
View File
@@ -46,7 +46,8 @@
{% include 'components/theme-switch.html' %} {% include 'components/theme-switch.html' %}
<!-- Show/Hide cart --> <!-- Show/Hide cart -->
<div id="navbar-cart-dropdown" hx-get="{% url 'web:cart_dropdown' %}" hx-trigger="load, updated-cart from:body"></div> <div id="navbar-cart-dropdown" hx-get="{% url 'web:cart_dropdown' %}"
hx-trigger="load, updated-cart from:body"></div>
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<!-- Show/Hide user account dropdown --> <!-- Show/Hide user account dropdown -->