replaced askama with tera, reworked the whole website and added nixos module
This commit is contained in:
60
templates/_base.css
Normal file
60
templates/_base.css
Normal file
@@ -0,0 +1,60 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family:
|
||||
"Inter",
|
||||
system-ui,
|
||||
-apple-system,
|
||||
Roboto,
|
||||
"Segoe UI",
|
||||
Arial,
|
||||
sans-serif;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #fff;
|
||||
overflow-x: hidden;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.8rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
nav {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
nav a {
|
||||
margin-right: 15px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 2rem;
|
||||
flex: 1;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
footer {
|
||||
padding: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: 1px solid #ddd;
|
||||
padding: 10px;
|
||||
border-radius: 8px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
html {
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Inter', system-ui, -apple-system, Roboto, "Segoe UI", Arial, sans-serif;
|
||||
padding: 20px;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background-color: #fff;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 1.8rem;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
text-align: left;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
max-width: 720px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
|
||||
img {
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: 600;
|
||||
display: block;
|
||||
margin-bottom: 0.25rem;
|
||||
font-size: 1.35rem;
|
||||
color: #222;
|
||||
}
|
||||
|
||||
input,
|
||||
textarea,
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 0.6rem 0.75rem;
|
||||
margin-bottom: 1rem;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
font-size: 1rem;
|
||||
color: #333333aa;
|
||||
background-color: #e0f0ff;
|
||||
border: 1px solid #88c1ff;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
input:focus,
|
||||
textarea:focus,
|
||||
select:focus {
|
||||
outline: #66aaffaa;
|
||||
background-color: #cce5ff;
|
||||
}
|
||||
|
||||
textarea {
|
||||
resize: none;
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 0.5rem 1rem;
|
||||
font-size: 1.3rem;
|
||||
border: none;
|
||||
border-radius: 0.25rem;
|
||||
cursor: pointer;
|
||||
background-color: #66aaff;
|
||||
color: #fff;
|
||||
transition: background-color 0.2s;
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #3390ff;
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
html {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ lang }}">
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>{% block title %}Dynamic Form{% endblock %}</title>
|
||||
<title>{{ title }}</title>
|
||||
<link rel="stylesheet" href="_base.css">
|
||||
<style>
|
||||
/*<![CDATA[*/
|
||||
{%~ include "_layout.css" ~%}
|
||||
/*]]>*/
|
||||
{% include "_base.css" %}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}{% endblock %}
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<a href="/showcase">Showcase</a>
|
||||
</nav>
|
||||
<main>
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
<footer>Quick rust website template</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
{% extends "_layout.html" %}
|
||||
|
||||
{% block title %}Home Page{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<p>Hello world!</p>
|
||||
</div>
|
||||
<h1>Welcome to the Home Page</h1>
|
||||
<p>This is a starter website built with Axum and Tera.</p>
|
||||
<p>The time on the server is: <strong>{{ server_time }}</strong></p>
|
||||
{% endblock %}
|
||||
|
||||
12
templates/showcase.html
Normal file
12
templates/showcase.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{% extends "_layout.html" %}
|
||||
{% block content %}
|
||||
<h1>Project Showcase</h1>
|
||||
<p>Here are some items passed from Rust to the template:</p>
|
||||
|
||||
{% for item in items %}
|
||||
<div class="card">
|
||||
<h3>{{ item.name }}</h3>
|
||||
<p>{{ item.description }}</p>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user