Notes can be displayed from a JSON String

Notes can be deleted (will not save to the JSON)
Notes can be added (will not save to the JSON)
You can click on a Note to open it but /editor route is not working properly
This commit is contained in:
dhain 2022-09-25 10:27:04 +02:00
parent bbec9e5e1b
commit 2705fe27ef
4 changed files with 51 additions and 14 deletions

View file

@ -0,0 +1 @@
// export const ssr = false;

View file

@ -0,0 +1,24 @@
<script lang="ts">
interface Note {
id: number;
title: string;
content: string;
}
let notes: Note[] = JSON.parse(window.localStorage.getItem("notes"));
const clickedNoteId = window.localStorage.getItem("clickedNoteId");
</script>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{"Pomelonote | Edit " + notes[clickedNoteId].title}</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
</head>
<div class="offset-3 col-6">
samc samg ccocooc {notes[clickedNoteId].content}
</div>