From 5334baa8ffc6b41109a630da98674576061fcd87 Mon Sep 17 00:00:00 2001 From: Deimos Date: Mon, 3 Sep 2018 17:18:54 -0600 Subject: [PATCH] Refactor collapsed comments' @extend usage Just some small adjustments to how @extend is used here, so that some of the styles that apply to "fully collapsed" chains don't get brought over to the "individually collapsed" comments when they're not wanted. The % syntax is SASS's recommendation for "@extend-only selectors". --- tildes/scss/_themes.scss | 12 +++++++++++- tildes/scss/modules/_comment.scss | 24 ++++++++++++++---------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/tildes/scss/_themes.scss b/tildes/scss/_themes.scss index 420765b..ac82454 100644 --- a/tildes/scss/_themes.scss +++ b/tildes/scss/_themes.scss @@ -116,7 +116,7 @@ .label-comment-tag-flame { @include specialtag($comment-tag-flame-color, $is-light); } } - .is-comment-collapsed { + %collapsed { header { background-color: $background-color; color: $text-secondary-color; @@ -127,6 +127,16 @@ } } + .is-comment-collapsed { + @extend %collapsed; + } + + .is-comment-collapsed-individual { + & > .comment-itself { + @extend %collapsed; + } + } + .is-comment-deleted, .is-comment-removed { color: $text-secondary-color; } diff --git a/tildes/scss/modules/_comment.scss b/tildes/scss/modules/_comment.scss index b519c5e..8ac06be 100644 --- a/tildes/scss/modules/_comment.scss +++ b/tildes/scss/modules/_comment.scss @@ -127,11 +127,7 @@ } } -.is-comment-collapsed { - &[data-comment-depth="0"] { - border-bottom: 0; - } - +%collapsed { .comment-edited-time, .comment-nav-link, .comment-posted-time, @@ -143,10 +139,6 @@ display: none; } - .comment-branch-counter { - display: inline-block; - } - .comment-excerpt { display: inline-block; } @@ -156,11 +148,23 @@ } } +.is-comment-collapsed { + @extend %collapsed; + + &[data-comment-depth="0"] { + border-bottom: 0; + } + + .comment-branch-counter { + display: inline-block; + } +} + // uses @extend to only collapse everything inside the collapsed comment itself and // not its replies .is-comment-collapsed-individual { & > .comment-itself { - @extend .is-comment-collapsed; + @extend %collapsed; } }