diff --git a/motorradig/public/css/custom.css b/motorradig/public/css/custom.css index c033e88..b9140fd 100644 --- a/motorradig/public/css/custom.css +++ b/motorradig/public/css/custom.css @@ -68,3 +68,68 @@ p { #fileElem { display: none; } + +/******************* + Modal styles +********************/ +.modal { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) scale(0); + transition: 200ms ease-in-out; + border: 1px solid black; + border-radius: 10px; + z-index: 10; + background-color: white; + width: 500px; + max-width: 80%; +} + +.modal.active { + transform: translate(-50%, -50%) scale(1); +} + +.modal-header { + padding: 10px 15px; + display: flex; + justify-content: space-between; + align-items: center; + border-bottom: 1px solid black; +} + +.modal-header .title { + font-size: 1.25rem; + font-weight: bold; +} + +.modal-header .close-button { + cursor: pointer; + border: none; + outline: none; + background: none; + font-size: 1.25rem; + font-weight: bold; +} + +.modal-body { + padding: 10px 15px; +} + +#overlay { + position: fixed; + opacity: 0; + transition: 200ms ease-in-out; + top: 0; + left: 0; + right: 0; + bottom: 0; + background-color: rgba(0, 0, 0, 0.5); + pointer-events: none; +} + +#overlay.active { + opacity: 1; + pointer-events: all; +} + diff --git a/motorradig/resources/js/modal.js b/motorradig/resources/js/modal.js new file mode 100644 index 0000000..c4a4315 --- /dev/null +++ b/motorradig/resources/js/modal.js @@ -0,0 +1,36 @@ +const openModalButtons = document.querySelectorAll("[data-modal-target]"); +const closeModalButtons = document.querySelectorAll("[data-close-button]"); +const overlay = document.getElementById("overlay"); + +openModalButtons.forEach((button) => { + button.addEventListener("click", () => { + const modal = document.querySelector(button.dataset.modalTarget); + openModal(modal); + }); +}); + +overlay.addEventListener("click", () => { + const modals = document.querySelectorAll(".modal.active"); + modals.forEach((modal) => { + closeModal(modal); + }); +}); + +closeModalButtons.forEach((button) => { + button.addEventListener("click", () => { + const modal = button.closest(".modal"); + closeModal(modal); + }); +}); + +function openModal(modal) { + if (modal == null) return; + modal.classList.add("active"); + overlay.classList.add("active"); +} + +function closeModal(modal) { + if (modal == null) return; + modal.classList.remove("active"); + overlay.classList.remove("active"); +} diff --git a/motorradig/resources/views/tour/show.blade.php b/motorradig/resources/views/tour/show.blade.php index 8d29d38..d99f651 100644 --- a/motorradig/resources/views/tour/show.blade.php +++ b/motorradig/resources/views/tour/show.blade.php @@ -75,12 +75,32 @@ @if(!App\Tour::has_participant($tour->id, Auth::user()->id)) Teilnehmen + @else Absagen @endif - + + + + @@ -121,34 +141,4 @@ - - - - - @endsection