Skip to content

Commit

Permalink
styels was updated
Browse files Browse the repository at this point in the history
  • Loading branch information
SergijPSO committed Nov 7, 2023
1 parent e9aa2bc commit a351f8b
Show file tree
Hide file tree
Showing 5 changed files with 191 additions and 169 deletions.
14 changes: 8 additions & 6 deletions edit.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>Edit page</title>
<link rel="shortcut icon" type="image/jpg" href="/notes-app/assets/ic_delete.svg"/>
<link rel="shortcut icon" type="image/jpg" href="/notes-app/assets/ic_delete.svg" />
<link rel="stylesheet" href="./styles/css/styles.css">
</head>

<body>
<div class="app">
<header class="app-header">
<header class="app-header app-header--edit">
<h1 class="app-header__title">Notes App</h1>
<span class="app-header__text">To save changes just hit "Save & Back"</span>
<button class="app-header__button">
<a class="app-header__link" href="/index.html">
<img src="./assets/arrow-left.svg" alt="arrow back" class="app-header__icon">
Back
Save & Back
</a>
</button>
</header>
Expand All @@ -27,7 +29,7 @@ <h2 class="app-content__title">Note</h2>
<input class="app-content__note-name" id="note-title" placeholder="Note title">

<label for="note-body" class="app-content__note-label">Description</label>
<textarea class="app-content__note-body"id="note-body" placeholder="Enter note text"></textarea>
<textarea class="app-content__note-body" id="note-body" placeholder="Enter note text"></textarea>

<span class="app-content__status">
<span class="app-content__status-text" id="last-edited"></span>
Expand All @@ -39,10 +41,10 @@ <h2 class="app-content__title">Note</h2>
</main>

</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.4/moment-with-locales.min.js"></script>
<script src="./notes-functions.js"></script>
<script src="./notes-edit.js" ></script>
<script src="./notes-edit.js"></script>
</body>

</html>
83 changes: 42 additions & 41 deletions notes-app.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,45 @@
'use strict'
"use strict";

let notes = getSavedNotes()
let notes = getSavedNotes();

const filters = {
searchText: '',
sortBy: 'byEdited',
}

renderNotes(notes, filters)

document.querySelector('#create-note').addEventListener('click', (e) => {
const id = uuidv4()
const timeStamp = moment().valueOf()

notes.push({
id: id,
title: '',
body: '',
ctreatedAt: timeStamp,
updatedAt: timeStamp
})

saveNotes(notes)
renderNotes(notes, filters)
location.assign(`/notes-app/edit.html#${id}`)
})

document.querySelector('#search-text').addEventListener('input', (e) => {
filters.searchText = e.target.value
renderNotes(notes, filters)
})

document.querySelector('#filter-by').addEventListener('change', (e) => {
filters.sortBy = e.target.value
renderNotes(notes, filters)
})

window.addEventListener('storage', (e) => {
if(e.key === 'notes') {
notes = JSON.parse(e.newValue)
renderNotes(notes, filters)
}
})
searchText: "",
sortBy: "byEdited",
};

renderNotes(notes, filters);

document.querySelector("#create-note").addEventListener("click", (e) => {
const id = uuidv4();
const timeStamp = moment().valueOf();

notes.push({
id: id,
title: "",
body: "",
ctreatedAt: timeStamp,
updatedAt: timeStamp,
});

saveNotes(notes);
renderNotes(notes, filters);
// location.assign(`/notes-app/edit.html#${id}`);
location.assign(`/edit.html#${id}`);
});

document.querySelector("#search-text").addEventListener("input", (e) => {
filters.searchText = e.target.value;
renderNotes(notes, filters);
});

document.querySelector("#filter-by").addEventListener("change", (e) => {
filters.sortBy = e.target.value;
renderNotes(notes, filters);
});

window.addEventListener("storage", (e) => {
if (e.key === "notes") {
notes = JSON.parse(e.newValue);
renderNotes(notes, filters);
}
});
118 changes: 63 additions & 55 deletions styles/css/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion styles/css/styles.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a351f8b

Please sign in to comment.