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;
}
#lib, #github {
color: white;
}
main {
max-width: 750px;
margin: 0 auto;
@ -83,6 +87,10 @@ span {
padding: 20px;
}
#stats {
margin-top: 10px;
}
/* User */
.user {
@ -124,6 +132,11 @@ span {
cursor: pointer;
}
#sort > div.selected {
background: aqua;
color: black;
}
#sort > div:hover {
background: #222;
}
@ -136,6 +149,15 @@ span {
display: flex;
}
.post.highlighted {
border: 2px solid #555;
background: #222;
}
.post.highlighted > .post_left {
background: #333;
}
.post:hover {
background: #222;
}
@ -158,6 +180,10 @@ span {
padding: 5px;
}
.post_right > p > span, .comment_right > p > span {
float: right;
}
.post_title {
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>
<html lang="en">
<head>
<title>Error loading page.</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">
</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>
{% extends "base.html" %}
{% block title %}Error: {{ message }}{% endblock %}
{% block sortstyle %}{% endblock %}
{% block content %}
<h1 style="text-align: center; font-size: 50px;">{{ message }}</h1>
</main>
</body>
</html>
{% endblock %}

View File

@ -1,22 +1,6 @@
<html>
<head>
<title>Libreddit</title>
<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>
{% extends "base.html" %}
{% block title %}Libreddit{% endblock %}
{% block content %}
<div id="sort">
<div id="sort_hot"><a href="?sort=hot">Hot</a></div>
<div id="sort_top"><a href="?sort=top">Top</a></div>
@ -57,6 +41,4 @@
<a href="?after={{ ends.1 }}">NEXT</a>
{% endif %}
</footer>
</main>
</body>
</html>
{% endblock %}

View File

@ -1,25 +1,12 @@
<html>
<head>
<title>{{ post.title }} - r/{{ post.community }}</title>
{% extends "base.html" %}
{% block title %}{{ post.title }} - r/{{ post.community }}{% endblock %}
{% block head %}
{% call super() %}
<meta name="author" content="u/{{ post.author }}">
<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">
<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 class="post" style="border: 2px solid #555;background: #222;">
<div class="post_left" style="background: #333;">
{% endblock %}
{% block content %}
<div class="post highlighted">
<div class="post_left">
<button class="post_upvote"></button>
<h3 class="post_score">{{ post.score }}</h3>
<button class="post_upvote"></button>
@ -30,7 +17,7 @@
&bull;
Posted by
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<span style="float: right;">{{ post.time }}</span>
<span>{{ post.time }}</span>
</p>
<h3 class="post_title">
{{ post.title }}
@ -59,12 +46,10 @@
<div class="comment_right">
<p>
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>
<h4 class="comment_body">{{ comment.body }}</h4>
</div>
</div><br>
{% endfor %}
</main>
</body>
</html>
{% endblock %}

View File

@ -1,21 +1,12 @@
<html>
<head>
<title>r/{{ sub.name }}: {{ sub.description }}</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">
<style>
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
</head>
<body>
{% extends "base.html" %}
{% block title %}r/{{ sub.name }}: {{ sub.description }}{% endblock %}
{% block body %}
{% block header %}
<header>
<a href="/"><span style="color:white">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a>
<a href="/"><span id="lib">lib</span>reddit.</a>
<a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
{% endblock %}
<div id="about">
<div class="subreddit">
<div class="subreddit_left">
@ -24,6 +15,7 @@
<div class="subreddit_right">
<h2 class="subreddit_name">r/{{ sub.name }}</h2>
<p class="subreddit_description">{{ sub.description }}</p>
<div id="stats">👤 {{ sub.members }} 🟢 {{ sub.active }}</div>
</div>
</div>
</div>
@ -46,7 +38,7 @@
&bull;
Posted by
<a class="post_author" href="/u/{{ post.author }}">u/{{ post.author }}</a>
<span style="float: right;">{{ post.time }}</span>
<span>{{ post.time }}</span>
</p>
<h3 class="post_title">
{% if post.flair.0 != "" %}
@ -69,5 +61,4 @@
{% endif %}
</footer>
</main>
</body>
</html>
{% endblock %}

View File

@ -1,21 +1,12 @@
<html>
<head>
<title>Libreddit: u/{{ user.name }}</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">
<style>
#sort > #sort_{{ sort }} {
background: aqua;
color: black;
}
</style>
</head>
<body>
{% extends "base.html" %}
{% block title %}Libreddit: u/{{ user.name }}{% endblock %}
{% block body %}
{% block header %}
<header>
<a href="/"><span style="color:white">lib</span>reddit.</a>
<a style="color:white" href="https://github.com/spikecodes/libreddit">GITHUB</a>
<a href="/"><span id="lib">lib</span>reddit.</a>
<a id="github" href="https://github.com/spikecodes/libreddit">GITHUB</a>
</header>
{% endblock %}
<div id="about">
<div class="user">
<div class="user_left">
@ -61,5 +52,4 @@
</div><br>
{% endfor %}
</main>
</body>
</html>
{% endblock %}