feat: add frontend UI for SimpleNote Web

- Vanilla JS frontend with dark theme
- Dashboard with sidebar (libraries tree, tags), document grid, search
- Document viewer with markdown rendering and metadata panel
- Document editor with split write/preview and formatting toolbar
- Login screen with token authentication
- All styled according to UI/UX specs (dark theme, accent #00d4aa)
- API client for all endpoints
- Responsive design
This commit is contained in:
Hiro
2026-03-28 11:44:42 +00:00
parent c3e48596f3
commit c4921c8e73
12 changed files with 2280 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
// Modal Component
export function showModal({ title, content, onConfirm, onCancel, confirmText = 'Confirm', cancelText = 'Cancel', danger = false }) {
const backdrop = document.createElement('div');
backdrop.className = 'modal-backdrop';
backdrop.innerHTML = `
<div class="modal">
<div class="modal-header">
<h3>${title}</h3>
</div>
<div class="modal-body">
${content}
</div>
<div class="modal-footer">
<button class="btn btn-ghost" id="modal-cancel">${cancelText}</button>
<button class="btn ${danger ? 'btn-danger' : 'btn-primary'}" id="modal-confirm">${confirmText}</button>
</div>
</div>
`;
document.body.appendChild(backdrop);
backdrop.querySelector('#modal-cancel').onclick = () => {
backdrop.remove();
if (onCancel) onCancel();
};
backdrop.querySelector('#modal-confirm').onclick = () => {
backdrop.remove();
if (onConfirm) onConfirm();
};
backdrop.onclick = (e) => {
if (e.target === backdrop) {
backdrop.remove();
if (onCancel) onCancel();
}
};
return backdrop;
}
export function hideModal(backdrop) {
if (backdrop && backdrop.parentElement) {
backdrop.remove();
}
}