Skip to content

Commit

Permalink
More fixes for the "commit-body" (#26898)
Browse files Browse the repository at this point in the history
The changes for "commit-body" in #26877 are not ideal.

The reason is: the "commit-body" is usually a `<pre>`, it has default
margins. In most cases, we do not need that large margin. So, this PR
introduces a general but small margin for all "commit-body" elements.
Then these `gt-m-0` could be removed.

The `:not` selector is not needed, because the `.timeline-item` selector
is already clear enough.
  • Loading branch information
wxiaoguang authored Sep 4, 2023
1 parent c17fd68 commit 6825523
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion templates/repo/commit_page.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
{{end}}
</div>
{{if IsMultilineCommitMessage .Commit.Message}}
<pre class="commit-body gt-mt-0">{{RenderCommitBody $.Context .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
<pre class="commit-body">{{RenderCommitBody $.Context .Commit.Message $.RepoLink $.Repository.ComposeMetas}}</pre>
{{end}}
{{template "repo/commit_load_branches_and_tags" .}}
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/commits_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
{{end}}
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}}
{{if IsMultilineCommitMessage .Message}}
<pre class="commit-body gt-m-0 gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
<pre class="commit-body gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
{{end}}
</td>
{{if .Committer}}
Expand Down
5 changes: 3 additions & 2 deletions web_src/css/repo.css
Original file line number Diff line number Diff line change
Expand Up @@ -2620,13 +2620,14 @@ tbody.commit-list {
}

.commit-body {
margin: 0.25em 0;
white-space: pre-wrap;
line-height: initial;
}

/* PR-comment */
.repository:not(.diff) .timeline-item .commit-body {
margin-left: 40px;
.repository .timeline-item .commit-body {
margin-left: 45px;
}

.git-notes.top {
Expand Down

0 comments on commit 6825523

Please sign in to comment.