From b2948e3071b377e44a5330dd00411f135b2a7683 Mon Sep 17 00:00:00 2001 From: Mitarashi Date: Thu, 13 Jan 2022 23:54:22 +0200 Subject: [PATCH] refined code --- src/sass/tweet/_base.scss | 20 +++++++++++--------- src/views/tweet.nim | 6 ++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/sass/tweet/_base.scss b/src/sass/tweet/_base.scss index 4950deb..80a1171 100644 --- a/src/sass/tweet/_base.scss +++ b/src/sass/tweet/_base.scss @@ -97,15 +97,17 @@ } } -.avatar-round { - border-radius: 50%; -} - -.avatar.mini { - margin-right: 5px; - margin-top: -1px; - width: 20px; - height: 20px; +.avatar { + &.round { + border-radius: 50%; + } + + &.mini { + margin-right: 5px; + margin-top: -1px; + width: 20px; + height: 20px; + } } .attribution { diff --git a/src/views/tweet.nim b/src/views/tweet.nim index 43662a6..9285d71 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -32,11 +32,9 @@ proc renderHeader(tweet: Tweet; retweet: string; prefs: Prefs): VNode = if not prefs.autoplayGifs and tweet.profile.userPic.endsWith("gif"): size = "_400x400" - let avatarClass = - if prefs.squareProfileImages: "avatar" - else: "avatar avatar-round" + let round = if prefs.squareProfileImages: "" else: " round" - genImg(tweet.profile.getUserPic(size), class=avatarClass) + genImg(tweet.profile.getUserPic(size), class=(&"avatar{round}")) tdiv(class="tweet-name-row"): tdiv(class="fullname-and-username"):