Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add (slightly better) mobile support for comments #1455

Merged
merged 1 commit into from
Jun 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions resources/comments.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ a {
}

.comment-operation {
float: right;
flex: auto;

.fa {
color: #444;
Expand Down Expand Up @@ -102,8 +102,7 @@ a {
.comment {
list-style: none none;
border-radius: $widget_border_radius;
margin: (-50px) -4px 10px -40px;
padding-top: 50px;
margin: 0px -4px 10px -40px;

&:target > .comment-box {
border-left: 10px solid $highlight_blue;
Expand All @@ -119,6 +118,19 @@ a {
}
}

.reply-comment {
margin: 0 23px 10px -40px;
}

@media (max-width: 760px) {
.comments {
padding-inline-start: 5%;
}
.comment {
margin-left: -5%;
}
}

.comment-author {
margin-bottom: 1em;

Expand Down
11 changes: 9 additions & 2 deletions templates/comments/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,21 @@ <h2><i style="padding-right: 0.3em" class="fa fa-comments"></i>{{ _('Comments')
{% endif %}
</div>
{% with author=node.author, user=node.author.user %}
<a href="{{ url('user_page', user.username) }}" class="user">
<a href="{{ url('user_page', user.username) }}" class="user gravatar-main">
<img src="{{ gravatar(author, 135) }}" class="gravatar">
</a>
{% endwith %}
</div>
<div class="detail">
<div class="header">
{{ link_user(node.author) }}&nbsp;
<span>
{% with author=node.author, user=node.author.user %}
<a href="{{ url('user_page', user.username) }}" class="user gravatar-mobile">
<img src="{{ gravatar(author, 135) }}" class="gravatar">
</a>
{% endwith %}
{{ link_user(node.author) }}&nbsp;
</span>
{{ relative_time(node.time, abs=_('commented on {time}'), rel=_('commented {time}')) }}
<span class="comment-spacer"></span>
<span class="comment-operation">
Expand Down
35 changes: 29 additions & 6 deletions templates/comments/media-css.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
.new-comments .comment .detail {
margin: 0px 15px 0px;
width: 100%;
max-width: calc(100% - 134px);
}

.new-comments .comment-edits {
Expand All @@ -41,6 +40,8 @@

.new-comments .comment .detail .header {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
padding: 2px 0px;
font-weight: normal;
border-bottom: 1px #888 solid;
Expand All @@ -66,12 +67,39 @@
max-width: 75px;
}

.new-comments .gravatar-mobile {
display: none;
}

.new-comments .gravatar-main {
display: unset;
}

.new-comments .vote {
margin-right: 1em;
height: 75px;
padding-top: 0.4em;
}

@media (max-width: 760px) {
.new-comments .gravatar {
width: 10px;
max-width: 10px;
}

.new-comments .gravatar-mobile {
display: unset;
}

.new-comments .gravatar-main {
display: none;
}

.new-comments .vote {
margin-right: 0em;
}
}

.new-comments .comment-display {
border-radius: 4px;
}
Expand Down Expand Up @@ -99,10 +127,5 @@
-o-transform: translatez(0);
transform: translatez(0);
}

.reply-comment {
margin: -50px 23px 10px -40px;
padding-top: 50px;
}
</style>
{% endcompress %}