login register

This commit is contained in:
SimonFJ20 2024-05-15 02:51:37 +02:00
parent cfe58f7b7a
commit b4bb95e339
13 changed files with 236 additions and 88 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -3,17 +3,22 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="/favicon.ico"> <link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="/static/common.css">
<script src="script.js" defer></script> <link rel="stylesheet" href="/static/index.css">
<title>grill blog</title> <script src="/static/index.js" defer></script>
<title>Materiel</title>
</head> </head>
<body> <body>
<header> <header>
<h1>grill blog</h1> <a href="/">
<h1>Materiel</h1>
</a>
</header> </header>
<main>
<div id="articles">dasdasdasd</div> <div id="articles">dasdasdasd</div>
</main>
<footer> <footer>
Copyright © 2024- The authors or something idk Copyright © 2024 S. F. Jakobsen
</footer> </footer>
</body> </body>
</html> </html>

36
public/login/index.html Normal file
View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="/static/common.css">
<link rel="stylesheet" href="/static/login.css">
<script src="/static/login.js" defer></script>
<title>Materiel</title>
</head>
<body>
<header>
<a href="/">
<h1>Materiel</h1>
</a>
</header>
<main>
<form method="post">
<h1>Login</h1>
<label for="username">Username</label>
<input id="username" name="username" type="text">
<br>
<label for="password">Password</label>
<input id="password" name="password" type="password">
<br>
<div id="action">
<input type="submit" value="Login">
<a href="/register">Create new account</a>
</div>
</form>
</main>
<footer>
Copyright © 2024 S. F. Jakobsen
</footer>
</body>
</html>

View File

@ -3,22 +3,25 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="/favicon.ico"> <link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="style.css"> <link rel="stylesheet" href="/static/common.css">
<script src="script.js" defer></script> <link rel="stylesheet" href="/static/reader.css">
<title>grill blog reader</title> <script src="/static/reader.js" defer></script>
<title>Materiel</title>
</head> </head>
<body> <body>
<header> <header>
<h1>grill blog</h1> <a href="/">
<h1>Materiel</h1>
</a>
</header> </header>
<main> <main>
<a href="..">Go back</a> <a href="/">Go back</a>
<div id="article"> <div id="article">
<p>Loading...</p> <p>Loading...</p>
</div> </div>
</main> </main>
<footer> <footer>
Copyright © 2024- The authors or something idk Copyright © 2024 S. F. Jakobsen
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -0,0 +1,36 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="/favicon.ico">
<link rel="stylesheet" href="/static/common.css">
<link rel="stylesheet" href="/static/register.css">
<script src="/static/register.js" defer></script>
<title>Materiel</title>
</head>
<body>
<header>
<a href="/">
<h1>Materiel</h1>
</a>
</header>
<main>
<form method="post">
<h1>Register</h1>
<label for="username">Username</label>
<input id="username" name="username" type="text">
<br>
<label for="password">Password</label>
<input id="password" name="password" type="password">
<br>
<div id="action">
<input type="submit" value="Register">
<a href="/login">Login instead</a>
</div>
</form>
</main>
<footer>
Copyright © 2024 S. F. Jakobsen
</footer>
</body>
</html>

View File

@ -1,4 +1,5 @@
* { * {
box-sizing: border-box; box-sizing: border-box;
} }
@ -21,6 +22,11 @@ header {
padding: 16px; padding: 16px;
} }
header a {
color: unset;
text-decoration: none;
}
header h1 { header h1 {
margin: 0; margin: 0;
} }
@ -34,21 +40,6 @@ p {
} }
main { main {
text-align: left;
max-width: 800px;
margin-left: auto;
margin-right: auto;
padding-left: 16px; padding-left: 16px;
padding-right: 16px; padding-right: 16px;
} }
#content {
margin: auto;
max-width: 600px;
}
#content p {
word-wrap: normal;
}

25
public/static/index.css Normal file
View File

@ -0,0 +1,25 @@
a {
color: unset;
text-decoration: none;
}
#articles {
text-align: left;
max-width: 1500px;
margin-left: auto;
margin-right: auto;
}
.article {
border-top: 2px solid;
border-bottom: 2px solid;
margin: 16px;
padding-left: 32px;
padding-right: 32px;
}
.article:hover {
cursor: pointer;
}

View File

@ -29,7 +29,7 @@ async function main() {
const articles = await requestArticles(); const articles = await requestArticles();
articlesDiv.innerHTML = articles.map((article) => ` articlesDiv.innerHTML = articles.map((article) => `
<a href="/reader/?id=${article.id}"> <a href="/reader?id=${article.id}">
<div class="article"> <div class="article">
<h1>${article.title}</h1> <h1>${article.title}</h1>
</p><i>${article.author}, ${ </p><i>${article.author}, ${

47
public/static/login.css Normal file
View File

@ -0,0 +1,47 @@
form {
margin: auto;
display: flex;
flex-direction: column;
max-width: 400px;
align-items: start;
text-align: left;
gap: 0.2em;
}
br {
margin-top: 10px;
}
#action {
margin: auto;
display: flex;
flex-direction: column;
max-width: 200px;
align-items: start;
text-align: center;
gap: 0.2em;
}
form > *, #action > * {
padding: 0.5em;
width: 100%;
}
form h1 {
margin: 0;
padding-left: 0;
padding-right: 0;
text-align: center;
font-size: 1.5em;
border-bottom: 2px solid;
margin-bottom: 0.5em;
}
a {
color: unset;
}

18
public/static/reader.css Normal file
View File

@ -0,0 +1,18 @@
main {
text-align: left;
max-width: 800px;
margin-left: auto;
margin-right: auto;
}
#content {
margin: auto;
max-width: 600px;
}
#content p {
word-wrap: normal;
}

View File

@ -0,0 +1,47 @@
form {
margin: auto;
display: flex;
flex-direction: column;
max-width: 400px;
align-items: start;
text-align: left;
gap: 0.2em;
}
br {
margin-top: 10px;
}
#action {
margin: auto;
display: flex;
flex-direction: column;
max-width: 200px;
align-items: start;
text-align: center;
gap: 0.2em;
}
form > *, #action > * {
padding: 0.5em;
width: 100%;
}
form h1 {
margin: 0;
padding-left: 0;
padding-right: 0;
text-align: center;
font-size: 1.5em;
border-bottom: 2px solid;
margin-bottom: 0.5em;
}
a {
color: unset;
}

View File

@ -1,60 +0,0 @@
* {
box-sizing: border-box;
}
:root {
color-scheme: dark;
}
body {
margin: 0;
height: 100vh;
text-align: center;
}
header {
border-bottom: 2px solid;
margin-left: 16px;
margin-right: 16px;
margin-bottom: 16px;
padding: 16px;
}
header h1 {
margin: 0;
}
footer {
padding: 32px;
}
p {
line-height: 1.6em;
}
a {
color: unset;
text-decoration: none;
}
#articles {
text-align: left;
max-width: 1500px;
margin-left: auto;
margin-right: auto;
}
.article {
border-top: 2px solid;
border-bottom: 2px solid;
margin: 16px;
padding-left: 32px;
padding-right: 32px;
}
.article:hover {
cursor: pointer;
}