mirror of
https://github.com/NohamR/Pocket-Bird.git
synced 2026-05-25 19:59:38 +00:00
Update build and sticky notes
This commit is contained in:
@@ -41,6 +41,9 @@ export class StickyNote {
|
||||
export function renderStickyNote(stickyNote, page, onSave, onDelete) {
|
||||
const noteElement = makeElement("birb-window");
|
||||
noteElement.classList.add("birb-sticky-note");
|
||||
const color = getColor(stickyNote.id);
|
||||
noteElement.style.setProperty("--birb-highlight", color);
|
||||
noteElement.style.setProperty("--birb-border-color", color);
|
||||
|
||||
// Create header
|
||||
const header = makeElement("birb-window-header");
|
||||
@@ -77,7 +80,7 @@ export function renderStickyNote(stickyNote, page, onSave, onDelete) {
|
||||
onDelete();
|
||||
noteElement.remove();
|
||||
}
|
||||
}, closeButton);
|
||||
}, closeButton, false);
|
||||
}
|
||||
|
||||
if (textarea && textarea instanceof HTMLTextAreaElement) {
|
||||
@@ -144,3 +147,14 @@ export function createNewStickyNote(stickyNotes, onSave, onDelete) {
|
||||
stickyNotes.push(stickyNote);
|
||||
onSave();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a color based on the mod of the sticky note ID
|
||||
* @param {string} id
|
||||
* @returns {string} A color hex code
|
||||
*/
|
||||
function getColor(id) {
|
||||
const colors = ["#ff8baa", "#79bcff", "#d18bff", "#6de192", "#ffd17c", "#ffb37c", "#ff7c7c"];
|
||||
const index = parseInt(id, 10) % colors.length;
|
||||
return colors[index];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user