MNotes/index.html
2025-05-20 20:03:37 +02:00

94 lines
3.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>MNotes</title>
<!-- Material Symbols -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
<!-- Roboto Font (recommended for Material Design) -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<!-- Material Web Components (MWC) - Using a more recent version -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@material/web@1.4.1/all.js"></script>
<style>
/* Minimal pre-render styles to avoid FOUC and ensure basic layout */
body {
font-family: 'Roboto', sans-serif;
margin: 0;
/* Fallback colors, MWC themes will override */
background-color: #fff;
color: #000;
opacity: 0; /* Initially hide body to prevent FOUC */
transition: opacity 0.2s ease-in-out;
}
body.loaded {
opacity: 1; /* Show body once MWC is likely ready */
}
/* Hide dialog by default to prevent flash of content if MWC is slow */
md-dialog {
display: none;
}
md-dialog[open] { /* MWC sets 'open' attribute which makes it visible */
display: flex; /* Or block, MWC handles actual display type */
}
</style>
</head>
<body>
<div class="container">
<header>
<h1 id="appTitle">MNotes</h1>
<md-icon-button id="themeToggleBtn" aria-label="Toggle theme">
<md-icon>dark_mode</md-icon> <!-- Icon will change dynamically -->
</md-icon-button>
</header>
<div id="notesList">
<!-- Notes will be rendered here by JavaScript -->
</div>
<md-fab aria-label="Add Note" id="addNoteFab" variant="primary">
<md-icon slot="icon">add</md-icon>
</md-fab>
</div>
<!-- Note Dialog (for creating/editing) -->
<md-dialog id="noteDialog">
<div slot="headline">Add/Edit Note</div>
<form slot="content" id="noteForm" method="dialog">
<input type="hidden" id="noteIdInput">
<md-filled-text-field label="Title" id="noteTitleInput" required style="width: 100%; margin-bottom: 16px;"></md-filled-text-field>
<md-outlined-text-field label="Content" id="noteContentInput" type="textarea" rows="5" required style="width: 100%; margin-bottom: 16px;"></md-outlined-text-field>
</form>
<div slot="actions">
<md-text-button form="noteForm" value="cancel">Cancel</md-text-button>
<md-filled-button form="noteForm" value="save" type="submit">Save</md-filled-button>
</div>
</md-dialog>
<script src="script.js"></script>
<script>
// Add 'loaded' class to body after MWC components are likely defined
function showBody() {
if (customElements.get('md-fab')) { // Check if a MWC component is defined
document.body.classList.add('loaded');
} else {
// Fallback if MWC takes longer or fails for some reason
setTimeout(() => document.body.classList.add('loaded'), 400);
}
}
if (document.readyState === 'loading') {
window.addEventListener('DOMContentLoaded', showBody);
} else {
showBody();
}
</script>
</body>
</html>