Reduce post padding

This commit is contained in:
spikecodes 2021-01-21 21:25:51 -08:00
parent 758b627660
commit 2270b6cf95
4 changed files with 10 additions and 17 deletions

View File

@ -1,5 +1,5 @@
// CRATES // CRATES
use crate::utils::{error, fetch_posts, param, prefs, request, val, Post, Preferences, cookie}; use crate::utils::{cookie, error, fetch_posts, param, prefs, request, val, Post, Preferences};
use actix_web::{HttpRequest, HttpResponse}; use actix_web::{HttpRequest, HttpResponse};
use askama::Template; use askama::Template;

View File

@ -98,7 +98,7 @@ async fn subreddit(sub: &str) -> Result<Subreddit, String> {
let active: i64 = res["data"]["accounts_active"].as_u64().unwrap_or_default() as i64; let active: i64 = res["data"]["accounts_active"].as_u64().unwrap_or_default() as i64;
// Fetch subreddit icon either from the community_icon or icon_img value // Fetch subreddit icon either from the community_icon or icon_img value
let community_icon: &str = res["data"]["community_icon"].as_str().unwrap_or("").split('?').collect::<Vec<&str>>()[0]; let community_icon: &str = res["data"]["community_icon"].as_str().map_or("", |s| s.split('?').collect::<Vec<&str>>()[0]);
let icon = if community_icon.is_empty() { val(&res, "icon_img") } else { community_icon.to_string() }; let icon = if community_icon.is_empty() { val(&res, "icon_img") } else { community_icon.to_string() };
let sub = Subreddit { let sub = Subreddit {

View File

@ -286,7 +286,7 @@ pub fn time(created: f64) -> (String, String) {
// val() function used to parse JSON from Reddit APIs // val() function used to parse JSON from Reddit APIs
pub fn val(j: &Value, k: &str) -> String { pub fn val(j: &Value, k: &str) -> String {
String::from(j["data"][k].as_str().unwrap_or_default()) j["data"][k].as_str().unwrap_or_default().to_string()
} }
// Fetch posts of a user or subreddit and return a vector of posts and the "after" value // Fetch posts of a user or subreddit and return a vector of posts and the "after" value

View File

@ -460,7 +460,7 @@ a.search_subreddit:hover {
} }
.post_score { .post_score {
padding-top: 20px; padding-top: 16px;
font-size: 13px; font-size: 13px;
font-weight: bold; font-weight: bold;
text-align: end; text-align: end;
@ -476,7 +476,7 @@ a.search_subreddit:hover {
} }
.post_header { .post_header {
margin: 20px 20px 5px 20px; margin: 15px 20px 5px 15px;
grid-area: post_header; grid-area: post_header;
} }
@ -487,7 +487,7 @@ a.search_subreddit:hover {
.post_title { .post_title {
font-size: 16px; font-size: 16px;
line-height: 1.5; line-height: 1.5;
margin: 5px 20px; margin: 5px 15px;
grid-area: post_title; grid-area: post_title;
} }
@ -548,7 +548,7 @@ a.search_subreddit:hover {
.post_body { .post_body {
opacity: 0.9; opacity: 0.9;
font-weight: normal; font-weight: normal;
margin: 5px 20px; margin: 5px 15px;
grid-area: post_body; grid-area: post_body;
} }
@ -558,7 +558,7 @@ a.search_subreddit:hover {
opacity: 0.5; opacity: 0.5;
font-size: 14px; font-size: 14px;
grid-area: post_footer; grid-area: post_footer;
margin: 5px 20px 20px 20px; margin: 5px 20px 15px 15px;
} }
.post_comments { .post_comments {
@ -925,20 +925,13 @@ td, th {
} }
.post_score { .post_score {
background-color: unset; margin: 5px 0px 20px 15px;
margin: 5px 0px 20px 20px;
padding: 0; padding: 0;
} }
.compact .post_score { .compact .post_score { padding: 0; }
background-color: unset;
margin: 2.5px 0px 15px 15px;
padding: 0;
font-size: 14px;
}
.post_score::before { content: "↑" } .post_score::before { content: "↑" }
.post:hover > .post_score { background: unset; }
.post_header { font-size: 14px; } .post_header { font-size: 14px; }
.post_footer { margin-left: 15px; } .post_footer { margin-left: 15px; }