mirror of
https://github.com/brufdev/many-notes.git
synced 2026-01-25 20:39:21 -06:00
Finish modal functionality
This commit is contained in:
20
app/Livewire/Modals/Modal.php
Normal file
20
app/Livewire/Modals/Modal.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Modals;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Modal extends Component
|
||||
{
|
||||
public bool $show = false;
|
||||
|
||||
public function openModal(): void
|
||||
{
|
||||
$this->show = true;
|
||||
}
|
||||
|
||||
public function closeModal(): void
|
||||
{
|
||||
$this->show = false;
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
<div x-on:click="modalOpen = true" tabindex="-1">
|
||||
<div x-on:click="modalOpen = true" tabindex="-1" class="flex items-center">
|
||||
{{ $slot }}
|
||||
</div>
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
@props(['top' => false])
|
||||
|
||||
@aware(['title'])
|
||||
|
||||
<template x-teleport="body">
|
||||
<div
|
||||
x-show="modalOpen"
|
||||
@keydown.escape.window="modalOpen = false"
|
||||
class="fixed inset-0 overflow-y-auto z-10 text-leftXXX pt-[30%] sm:pt-0 text-light-base-700 dark:text-base-200"
|
||||
>
|
||||
<div x-show="modalOpen" @keydown.escape.window="modalOpen = false"
|
||||
class="fixed inset-0 overflow-y-auto z-50 pt-[30%] sm:pt-0 text-light-base-700 dark:text-base-200">
|
||||
<div class="fixed inset-0 bg-black/25"></div>
|
||||
|
||||
<div class="relative flex items-end justify-center min-h-full p-0 sm:items-center sm:p-4">
|
||||
<div
|
||||
@click.outside="modalOpen = false"
|
||||
x-trap="modalOpen"
|
||||
class="relative w-full overflow-hidden shadow-lg sm:mx-auto sm:max-w-md bg-light-base-50 dark:bg-base-900 rounded-t-xl sm:rounded-b-xl"
|
||||
>
|
||||
<div class="relative flex justify-center min-h-full p-0 sm:p-4{{ $top ? '' : ' items-end sm:items-center' }}">
|
||||
<div @click.outside="modalOpen = false" x-trap="modalOpen"
|
||||
class="relative w-full overflow-hidden shadow-lg sm:mx-auto sm:max-w-md bg-light-base-50 dark:bg-base-900 rounded-t-xl sm:rounded-b-xl">
|
||||
<div class="flex justify-between p-6 pb-0">
|
||||
<h3 class="text-lg">{{ $title }}</h3>
|
||||
<x-modal.close class="flex items-center">
|
||||
|
||||
Reference in New Issue
Block a user