-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
211 lines (163 loc) · 6.4 KB
/
index.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!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>Todo</title>
<!--
<script>
tailwind.config = {
theme: {
extend: {}
},
plugins: [
require('@tailwindcss/forms'),
// ...
],
}
</script> -->
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
<!-- <script>
const btns = document.querySelectorAll(".accordion-btn");
const btnSvg = document.querySelectorAll("svg.arrow")
const btnP = document.querySelectorAll("button + div")
const nav = document.querySelector("nav")
const navBtn = document.querySelector(".navBtn")
const container = document.querySelector(`.acrd-list`)
const containerItem = document.querySelectorAll(".container-item")
const tooltipSvg = document.querySelectorAll("svg.toolTipEnable")
const tooltip = document.querySelectorAll("[data-span-hover]")
// selects flag icon (here we select to use our priorty changing toolip )
const priortyChangeToolTipSVGs = document.querySelectorAll("button > div:nth-child(4)")
priortyChangeToolTipSVGs.forEach(span => span.addEventListener("click", () => {
const tooltip = span.children[2];
tooltip.classList.remove("opacity-0")
tooltip.classList.remove("pointer-events-none")
tooltip.classList.add("opacity-1")
tooltip.classList.add("z-50")
// to add remove effect activate overlay
overlay.classList.remove("pointer-events-none")
}))
// modals
const openModalBtns = document.querySelectorAll("[data-modal-target]")
const closeModalBtns = document.querySelectorAll("[data-close-button]")
const overlay = document.querySelector("#overlay")
// close modal if we click outside of it
overlay.addEventListener("click", () => {
const modals = [...document.querySelectorAll(".modal")]
modals.forEach(modal => closeModal(modal))
// close priorty tooltip btn if it's opened
const toolTips = [...document.querySelectorAll("button > div:nth-child(4) > [data-span-priorty")]
const tooltip = toolTips.filter(span => span.className.includes("opacity-1"))
tooltip[0].classList.remove("opacity-1")
tooltip[0].classList.add("opacity-0")
tooltip[0].classList.add("pointer-events-none")
})
openModalBtns.forEach(button => button.addEventListener("click", () => {
const modal = document.querySelector(button.dataset.modalTarget)
openModal(modal);
}))
closeModalBtns.forEach(button => button.addEventListener("click", () => {
const modal = button.closest(".modal") //find closest button with class modal
closeModal(modal);
}))
const openModal = (modal) => {
modal.classList.remove("scale-0")
overlay.classList.remove("opacity-0")
overlay.classList.remove("pointer-events-none")
}
const closeModal = (modal) => {
modal.classList.add("scale-0")
overlay.classList.add("opacity-0")
overlay.classList.add("pointer-events-none")
}
tooltipSvg.forEach((svg, index) => svg.addEventListener("mouseover", () => {
tooltip[index].classList.remove("opacity-0")
tooltip[index].classList.add("opacity-1")
}))
tooltipSvg.forEach((svg, index) => svg.addEventListener("mouseout", () => {
tooltip[index].classList.remove("opacity-1")
tooltip[index].classList.add("opacity-0")
}))
// Create a condition that targets viewports less than 768px wide
const mediaQuery = window.matchMedia('(max-width: 768px)')
// Open nav if the app is being viewed in md screens
if (!mediaQuery.matches) {
nav.classList.add("translate-x-0")
}
function openNavDefault(e) {
// Check if the media query is true
if (e.matches) {
// Then log the following message to the console
nav.classList.add("translate-x-0")
document.body.classList.add("overflow-hidden")
container.classList.add("overflow-y-scroll")
} else { //if the media query isnt true that means we're in md screens
nav.classList.add("translate-x-0")
}
}
const makeAnim = () => {
setTimeout(() => {
container.classList.add("overflow-visible")
if (!mediaQuery.matches) {
// if we aren't in phone screens
container.classList.remove("overflow-y-scroll")
}
containerItem.forEach(item => item.classList.add("mleft-32"))
}, 500)
}
const stopAnim = () => {
setTimeout(() => {
container.classList.remove("overflow-visible")
container.classList.add("overflow-y-scroll")
containerItem.forEach(item => item.classList.remove("mleft-32"))
}, 500)
}
const openNav = () => {
// open it
// nav.classList.add("toggle")
// Register event listener
mediaQuery.addListener(openNavDefault)
// Initial check
openNavDefault(mediaQuery)
stopAnim();
// check if it's opened in md screens
// if it is close it
}
const closeNav = () => {
// nav.classList.remove("toggle")
nav.classList.remove("translate-x-0")
document.body.classList.remove("overflow-hidden")
makeAnim();
}
navBtn.addEventListener("click", () => {
// if the navbar is closed...
if (!nav.className.includes("translate-x-0")) {
openNav();
} else {
closeNav();
}
})
btns.forEach((btn, index) => btn.addEventListener("click", () => {
// If the accordion is closed
if (btnP[index].className.includes("h-0")) {
openAccordion(index);
} else {
closeAccordion(index);
}
}))
const openAccordion = (index) => {
btnP[index].classList.remove("h-0", "opacity-0", "py-0", "whitespace-nowrap", "overflow-hidden")
btnSvg[index].classList.add("rotate-180")
}
const closeAccordion = (index) => {
btnP[index].classList.add("h-0", "opacity-0", "py-0", "whitespace-nowrap", "overflow-hidden")
btnSvg[index].classList.remove("rotate-180")
}
</script> -->
</html>