-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
40 lines (36 loc) · 1.91 KB
/
index.html
File metadata and controls
40 lines (36 loc) · 1.91 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
<title>Notes App</title>
</head>
<body class="p-4">
<div x-data="app()" x-init="loadNotes()">
<input type="text" placeholder="Enter heading" x-model="noteHeading" class="w-full rounded p-2 mb-4 border-2 font-bold">
<textarea x-model="noteText" placeholder="Enter your note" class="w-full rounded p-2 mb-4 border-2"></textarea>
<button @click="addNote" class="bg-blue-500 text-white rounded py-2 px-4">Add Note</button>
<hr class="my-4">
<div x-show="notes.length > 0">
<h2 class="text-xl font-bold mb-2">Notes:</h2>
<ul>
<template x-for="note in notes" :key="note.id">
<li class="py-2">
<input x-model="note.heading" type="text" x-on:input="updateNoteText(note)" class="w-full rounded p-2 mb-2 border-2 font-bold">
<textarea x-model="note.text" x-on:input="updateNoteText(note)"
class="mb-2 w-full rounded p-2 border-2"></textarea>
<button @click="deleteNote(note.id)"
class="bg-red-500 text-white rounded py-1 px-2">Delete</button>
</li>
</template>
</ul>
</div>
<button @click="copyNotes" class="bg-green-500 text-white rounded py-2 px-4 mt-4">Copy as JSON</button>
<button @click="deleteAllNotes" class="bg-red-500 text-white rounded py-2 px-4 md:ml-2">Delete All</button>
</div>
<script src="https://unpkg.com/alpinejs" defer></script>
<script src="https://cdn.jsdelivr.net/npm/uuid@8.3.2/dist/umd/uuidv4.min.js"></script>
<script src="app.js"></script>
</body>
</html>