- new simpler modal without bootstrap
- new loadingbutton component
- cleanupsome old code
- toolbar adjusments
This commit is contained in:
Jérémy Guillot
2024-06-30 12:44:41 +02:00
parent b4f0811bca
commit ba30d3102d
23 changed files with 403 additions and 302 deletions

View File

@@ -34,16 +34,18 @@
{% for manga in mangas %}
<div
class="bg-white overflow-hidden border border-gray-200 hover:shadow-lg hover:border-gray-400 transition-all duration-300 flex">
<img src="{{ manga.imageUrl ?? 'https://placehold.co/150x220' }}" alt="{{ manga.title }}"
class="w-32 h-48 object-cover">
<div class="p-4 flex flex-col justify-between flex-grow">
<div>
<h3 class="text-lg font-semibold">{{ manga.title }}</h3>
<p class="text-sm text-gray-500">{{ manga.publicationYear }}</p>
<p class="text-sm text-gray-600 mt-2">{{ manga.description|truncate(200) }}</p>
<a class="flex flex-row" href="{{ path('app_manga_show', {'mangaSlug': manga.slug}) }}">
<img src="{{ manga.imageUrl ?? 'https://placehold.co/150x220' }}" alt="{{ manga.title }}"
class="w-32 h-48 object-cover">
<div class="p-4 flex flex-col justify-between flex-grow">
<div>
<h3 class="text-lg font-semibold">{{ manga.title }}</h3>
<p class="text-sm text-gray-500">{{ manga.publicationYear }}</p>
<p class="text-sm text-gray-600 mt-2">{{ manga.description|truncate(350) }}</p>
</div>
<p class="text-xs text-gray-400 mt-2">Added: {{ manga.createdAt|date('M d, Y') }}</p>
</div>
<p class="text-xs text-gray-400 mt-2">Added: {{ manga.createdAt|date('M d, Y') }}</p>
</div>
</a>
</div>
{% else %}
<p class="text-center text-gray-500">Aucun manga trouvé.</p>

View File

@@ -62,21 +62,39 @@
<div data-controller="table" data-table-open-value="{{ is_first ? 'true' : 'false' }}">
<div class="bg-white rounded-sm shadow mb-4">
<div class="flex items-center justify-between bg-white p-4 rounded-t-sm">
<div class="flex flex-row gap-4">
<i class="fas fa-bookmark text-gray-500 text-3xl"></i>
<h2 class="text-xl font-semibold">Volume {{ '%02d'|format(volume) }}</h2>
<div class="flex items-center">
<span
class="px-2 py-1 text-sm rounded {{ available_chapters|length > 0 ? 'bg-green-500 text-white' : 'bg-red-500 text-white' }}">
<div class="relative flex items-center justify-between bg-white p-4 rounded-t-sm">
<!-- Partie gauche -->
<div class="flex items-center space-x-4">
<i class="fas fa-bookmark text-gray-500 text-3xl w-8"></i>
<h2 class="text-xl font-semibold w-28">Volume {{ '%02d'|format(volume) }}</h2>
<div class="flex items-center w-16">
<span class="px-2 py-1 text-sm rounded w-full text-center
{% if available_chapters|length == 0 %}
bg-red-500 text-white
{% elseif available_chapters|length < total_chapters %}
bg-yellow-500 text-white
{% else %}
bg-green-500 text-white
{% endif %}">
{{ available_chapters|length }} / {{ total_chapters }}
</span>
</div>
</div>
<div class="flex items-center">
<span class="text-gray-600 mr-2">{{ chapters|length }} Chapters</span>
<!-- Chevron centré -->
<div class="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2">
<i data-table-target="toggleIcon" data-action="click->table#toggle"
class="fas fa-chevron-{{ is_first ? 'up' : 'down' }} cursor-pointer"></i>
class="bg-gray-400 rounded-full font-bold text-sm text-white p-1 hover:bg-green-500 fas fa-chevron-{{ is_first ? 'up' : 'down' }} cursor-pointer"></i>
</div>
<!-- Partie droite -->
<div class="flex space-x-2 text-xl text-bold">
<a href="#" class="w-8 text-center">
<i class="fas fa-search text-gray-500 hover:text-green-500"></i>
</a>
<a href="#" class="w-8 text-center">
<i class="fas fa-download text-gray-500 hover:text-green-500"></i>
</a>
</div>
</div>
@@ -161,9 +179,74 @@
{% endif %}
</tbody>
</table>
<div class="relative flex items-center justify-between bg-white mt-4 mb-2 rounded-t-sm">
<div
class="absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2">
<i data-table-target="toggleIcon" data-action="click->table#toggle"
class="bg-gray-400 rounded-full font-bold text-sm text-white p-1 hover:bg-green-500 fas fa-chevron-up cursor-pointer"></i>
</div>
</div>
</div>
</div>
</div>
{% endfor %}
</div>
{# Modal d'édition #}
<twig:Modal
openTrigger="openEditModal"
closeTrigger="closeEditModal"
title="Edit Manga"
>
{% block content %}
<form id="editForm" method="post" action="">
<div class="mb-4">
<label for="title" class="block text-gray-700 text-sm font-bold mb-2">Title:</label>
<input type="text" id="title" name="title" value="{{ manga.title }}"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="mb-4">
<label for="description" class="block text-gray-700 text-sm font-bold mb-2">Description:</label>
<textarea id="description" name="description"
class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 leading-tight focus:outline-none focus:shadow-outline"
rows="3">{{ manga.description }}</textarea>
</div>
{# Ajoutez d'autres champs selon vos besoins #}
</form>
{% endblock %}
{% block footer %}
<button type="submit" form="editForm"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-600 text-base font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm">
Save
</button>
<button type="button" data-action="modal#close"
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Cancel
</button>
{% endblock %}
</twig:Modal>
{# Modal de confirmation de suppression #}
<twig:Modal
openTrigger="openDeleteModal"
closeTrigger="closeDeleteModal"
title="Delete Manga"
>
<twig:block name="content">
<p class="text-sm text-gray-500">
Are you sure you want to delete this manga? This action cannot be undone.
</p>
</twig:block>
<twig:block name="footer">
<form id="deleteForm" method="post" action="">
<button type="submit"
class="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-red-600 text-base font-medium text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 sm:ml-3 sm:w-auto sm:text-sm">
Delete
</button>
</form>
<button type="button" data-action="modal#close"
class="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm">
Cancel
</button>
</twig:block>
</twig:Modal>
{% endblock %}