Update button styling and render additional elements on file page if authenticated
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
export function layout(title: string, body: string, opts: { authed?: boolean; hideLogo?: boolean } = {}): string {
|
||||
const { authed = false, hideLogo = false } = opts;
|
||||
export function layout(title: string, body: string, opts: { authed?: boolean; hideHeader?: boolean } = {}): string {
|
||||
const { authed = false, hideHeader = false } = opts;
|
||||
const nav = authed
|
||||
? `<nav>
|
||||
<a href="/upload">Upload</a>
|
||||
@@ -10,6 +10,13 @@ export function layout(title: string, body: string, opts: { authed?: boolean; hi
|
||||
</nav>`
|
||||
: '';
|
||||
|
||||
const header = hideHeader
|
||||
? ''
|
||||
: ` <header>
|
||||
<a href="/" class="logo">Nanodrop</a>
|
||||
${nav}
|
||||
</header>`;
|
||||
|
||||
return `<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -19,10 +26,7 @@ export function layout(title: string, body: string, opts: { authed?: boolean; hi
|
||||
<link rel="stylesheet" href="/public/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
${hideLogo ? '' : '<a href="/" class="logo">Nanodrop</a>'}
|
||||
${nav}
|
||||
</header>
|
||||
${header}
|
||||
<main>
|
||||
${body}
|
||||
</main>
|
||||
|
||||
Reference in New Issue
Block a user