53 lines
1.8 KiB
Plaintext
53 lines
1.8 KiB
Plaintext
package templates
|
|
|
|
templ Layout(title string) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>{ title }</title>
|
|
<link rel="stylesheet" href="/static/css/style.css"/>
|
|
<script src="https://unpkg.com/htmx.org@1.9.11"></script>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<div class="header-top">
|
|
<h1>/malago</h1>
|
|
<div class="nav">
|
|
<a href="/">home</a>
|
|
<a href="/catalog">catalog</a>
|
|
<a href="/watchlist">watchlist</a>
|
|
</div>
|
|
<form action="/" method="GET" style="display: flex; align-items: center; gap: 0;">
|
|
<input type="text" name="q" class="search-input" placeholder="search anime..." />
|
|
<button type="submit" class="search-button">go</button>
|
|
</form>
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
{ children... }
|
|
</main>
|
|
<div id="toast-container" style="position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px;"></div>
|
|
<script>
|
|
document.body.addEventListener('toast', function(evt) {
|
|
const container = document.getElementById('toast-container');
|
|
const toast = document.createElement('div');
|
|
toast.style.cssText = 'background: var(--surface); color: var(--text); border: 1px solid var(--border); padding: 12px 16px; font-size: 13px; font-weight: 500; opacity: 0; transition: opacity 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.5);';
|
|
toast.textContent = evt.detail.value;
|
|
container.appendChild(toast);
|
|
|
|
// fade in
|
|
requestAnimationFrame(() => { toast.style.opacity = '1'; });
|
|
|
|
// remove after 3s
|
|
setTimeout(() => {
|
|
toast.style.opacity = '0';
|
|
setTimeout(() => { toast.remove(); }, 300);
|
|
}, 3000);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|
|
} |