-
Notifications
You must be signed in to change notification settings - Fork 3
/
modal-confirm.html
59 lines (55 loc) · 3.5 KB
/
modal-confirm.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Modal Confirm</title>
<script src="https://cdn.tailwindcss.com"></script>
<script src="//unpkg.com/alpinejs" defer></script>
</head>
<style>
[x-cloak] {
display: none !important;
}
</style>
<body>
<!-- Layout -->
<div class="container mx-auto p-6 text-center">
<div x-data="{ open: false }" class="mt-6" >
<!-- Modal Button -->
<button @click="open = true; $nextTick(() => $refs.closeBtn.focus())" class="bg-gray-700 text-white px-4 py-2 rounded no-outline focus:shadow-outline select-none" >Modal Confirm</button>
<!-- End Modal Button -->
<!-- Open Modal -->
<div x-show="open" @mousedown.away="open = false" @keydown.window.escape="open = false"
x-transition:enter="transition ease-out duration-200"
x-transition:enter-start="opacity-0 transform scale-90"
x-transition:enter-end="opacity-100 transform scale-100"
x-transition:leave="transition ease-in duration-200"
x-transition:leave-start="opacity-100 transform scale-100"
x-transition:leave-end="opacity-0 transform scale-90"
class="absolute top-0 left-0 w-full h-full flex items-center justify-center" style="background-color: rgba(0,0,0,.5);">
<div @click.away="open = false" class="text-left bg-white h-auto p-4 md:max-w-xl md:p-6 lg:p-10 shadow-xl rounded-lg mx-2 md:mx-0" >
<div class="flex justify-between items-center">
<div class="text-2xl">Modal title</div>
<!-- Modal Close -->
<button class="" @click="open = false">
<svg class="w-4 tex-gray-700 fill-current transition duration-150" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512.001 512.001">
<path d="M284.286 256.002L506.143 34.144c7.811-7.811 7.811-20.475 0-28.285-7.811-7.81-20.475-7.811-28.285 0L256 227.717 34.143 5.859c-7.811-7.811-20.475-7.811-28.285 0-7.81 7.811-7.811 20.475 0 28.285l221.857 221.857L5.858 477.859c-7.811 7.811-7.811 20.475 0 28.285a19.938 19.938 0 0014.143 5.857 19.94 19.94 0 0014.143-5.857L256 284.287l221.857 221.857c3.905 3.905 9.024 5.857 14.143 5.857s10.237-1.952 14.143-5.857c7.811-7.811 7.811-20.475 0-28.285L284.286 256.002z" />
</svg>
</button>
<!-- Modal Close -->
</div>
<div class="text-gray-600 mt-4">Lorem ipsum dolor sit amet consectetur adipisicing earum?</div>
<div class="flex space-x-4 mt-8">
<button x-ref="closeBtn" class="focus:outline-none focus:ring focus:ring-gray-700 hover:bg-gray-700 border border-gray-700 text-gray-700 hover:text-gray-100 px-4 py-2 rounded no-outline focus:shadow-outline select-none" @click="open = false">Confirm</button>
<button class="hover:bg-gray-700 border border-gray-700 text-gray-700 hover:text-gray-100 px-4 py-2 rounded no-outline focus:shadow-outline select-none" @click="open = false">Cancel</button>
</div>
</div>
</div>
<!-- End Open Modal -->
</div>
</div>
<!-- End Layout -->
</body>
</html>