Create Base Template

This commit is contained in:
spikecodes 2020-11-22 16:29:05 -08:00
parent 215af3b75f
commit 7e79a0b712
7 changed files with 276 additions and 280 deletions

View File

@ -22,6 +22,10 @@ header {
font-size: 20px; font-size: 20px;
} }
#lib, #github {
color: white;
}
main { main {
max-width: 750px; max-width: 750px;
margin: 0 auto; margin: 0 auto;
@ -83,6 +87,10 @@ span {
padding: 20px; padding: 20px;
} }
#stats {
margin-top: 10px;
}
/* User */ /* User */
.user { .user {
@ -124,6 +132,11 @@ span {
cursor: pointer; cursor: pointer;
} }
#sort > div.selected {
background: aqua;
color: black;
}
#sort > div:hover { #sort > div:hover {
background: #222; background: #222;
} }
@ -136,6 +149,15 @@ span {
display: flex; display: flex;
} }
.post.highlighted {
border: 2px solid #555;
background: #222;
}
.post.highlighted > .post_left {
background: #333;
}
.post:hover { .post:hover {
background: #222; background: #222;
} }
@ -158,6 +180,10 @@ span {
padding: 5px; padding: 5px;
} }
.post_right > p > span, .comment_right > p > span {
float: right;
}
.post_title { .post_title {
font-size: 20px; font-size: 20px;
} }

34
templates/base.html Normal file
View File

@ -0,0 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<head>
{% block head %}
<title>{% block title %}{% endblock %}</title>
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit.">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="/style.css">
{% block sortstyle %}
<style>
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
{% endblock %}
{% endblock %}
</head>
<body>
{% block body %}
{% block header %}
<header>
<a href="/"><span id="lib">lib</span>reddit.</a>
<a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
{% endblock %}
<main>
{% block content %}
{% endblock %}
</main>
{% endblock %}
</body>
</html>

View File

@ -1,18 +1,6 @@
<!DOCTYPE html> {% extends "base.html" %}
<html lang="en"> {% block title %}Error: {{ message }}{% endblock %}
<head> {% block sortstyle %}{% endblock %}
<title>Error loading page.</title> {% block content %}
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit.">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="/style.css">
</head>
<body>
<header>
<a href="/"><span style="color:white">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
<main>
<h1 style="text-align: center; font-size: 50px;">{{ message }}</h1> <h1 style="text-align: center; font-size: 50px;">{{ message }}</h1>
</main> {% endblock %}
</body>
</html>

View File

@ -1,22 +1,6 @@
<html> {% extends "base.html" %}
<head> {% block title %}Libreddit{% endblock %}
<title>Libreddit</title> {% block content %}
<meta name="description" content="Alternative private front-end to Reddit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="/style.css">
<style>
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
</head>
<body>
<header>
<a href="/"><span style="color:white">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
<main>
<div id="sort"> <div id="sort">
<div id="sort_hot"><a href="?sort=hot">Hot</a></div> <div id="sort_hot"><a href="?sort=hot">Hot</a></div>
<div id="sort_top"><a href="?sort=top">Top</a></div> <div id="sort_top"><a href="?sort=top">Top</a></div>
@ -57,6 +41,4 @@
<a href="?after={{ ends.1 }}">NEXT</a> <a href="?after={{ ends.1 }}">NEXT</a>
{% endif %} {% endif %}
</footer> </footer>
</main> {% endblock %}
</body>
</html>

View File

@ -1,25 +1,12 @@
<html> {% extends "base.html" %}
<head> {% block title %}{{ post.title }} - r/{{ post.community }}{% endblock %}
<title>{{ post.title }} - r/{{ post.community }}</title> {% block head %}
{% call super() %}
<meta name="author" content="u/{{ post.author }}"> <meta name="author" content="u/{{ post.author }}">
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit."> {% endblock %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> {% block content %}
<link rel="stylesheet" href="/style.css"> <div class="post highlighted">
<style> <div class="post_left">
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
</head>
<body>
<header>
<a href="/"><span style="color:white">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
<main>
<div class="post" style="border: 2px solid #555;background: #222;">
<div class="post_left" style="background: #333;">
<button class="post_upvote"></button> <button class="post_upvote"></button>
<h3 class="post_score">{{ post.score }}</h3> <h3 class="post_score">{{ post.score }}</h3>
<button class="post_upvote"></button> <button class="post_upvote"></button>
@ -30,7 +17,7 @@
&bull; &bull;
Posted by Posted by
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a> <a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<span style="float: right;">{{ post.time }}</span> <span>{{ post.time }}</span>
</p> </p>
<h3 class="post_title"> <h3 class="post_title">
{{ post.title }} {{ post.title }}
@ -59,12 +46,10 @@
<div class="comment_right"> <div class="comment_right">
<p> <p>
Posted by <a class="comment_author" href="/u/{{ comment.author }}">u/{{ comment.author }}</a> Posted by <a class="comment_author" href="/u/{{ comment.author }}">u/{{ comment.author }}</a>
<span style="float: right;">{{ comment.time }}</span> <span>{{ comment.time }}</span>
</p> </p>
<h4 class="comment_body">{{ comment.body }}</h4> <h4 class="comment_body">{{ comment.body }}</h4>
</div> </div>
</div><br> </div><br>
{% endfor %} {% endfor %}
</main> {% endblock %}
</body>
</html>

View File

@ -1,21 +1,12 @@
<html> {% extends "base.html" %}
<head> {% block title %}r/{{ sub.name }}: {{ sub.description }}{% endblock %}
<title>r/{{ sub.name }}: {{ sub.description }}</title> {% block body %}
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit."> {% block header %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="/style.css">
<style>
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
</head>
<body>
<header> <header>
<a href="/"><span style="color:white">lib</span>reddit.</a> <a href="/"><span id="lib">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a> <a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header> </header>
{% endblock %}
<div id="about"> <div id="about">
<div class="subreddit"> <div class="subreddit">
<div class="subreddit_left"> <div class="subreddit_left">
@ -24,6 +15,7 @@
<div class="subreddit_right"> <div class="subreddit_right">
<h2 class="subreddit_name">r/{{ sub.name }}</h2> <h2 class="subreddit_name">r/{{ sub.name }}</h2>
<p class="subreddit_description">{{ sub.description }}</p> <p class="subreddit_description">{{ sub.description }}</p>
<div id="stats">👤 {{ sub.members }} 🟢 {{ sub.active }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -46,7 +38,7 @@
&bull; &bull;
Posted by Posted by
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a> <a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<span style="float: right;">{{ post.time }}</span> <span>{{ post.time }}</span>
</p> </p>
<h3 class="post_title"> <h3 class="post_title">
{% if post.flair.0 != "" %} {% if post.flair.0 != "" %}
@ -69,5 +61,4 @@
{% endif %} {% endif %}
</footer> </footer>
</main> </main>
</body> {% endblock %}
</html>

View File

@ -1,21 +1,12 @@
<html> {% extends "base.html" %}
<head> {% block title %}Libreddit: u/{{ user.name }}{% endblock %}
<title>Libreddit: u/{{ user.name }}</title> {% block body %}
<meta name="description" content="View on Libreddit, an alternative private front-end to Reddit."> {% block header %}
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="/style.css">
<style>
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
</head>
<body>
<header> <header>
<a href="/"><span style="color:white">lib</span>reddit.</a> <a href="/"><span id="lib">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a> <a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header> </header>
{% endblock %}
<div id="about"> <div id="about">
<div class="user"> <div class="user">
<div class="user_left"> <div class="user_left">
@ -61,5 +52,4 @@
</div><br> </div><br>
{% endfor %} {% endfor %}
</main> </main>
</body> {% endblock %}
</html>