Skip to content

Commit 52cbe2b

Browse files
silverwind6543techknowlogick
authored
Improve commit status icons (#21124)
- Show popover on hover/focus (tippy default) instead of click - If there is only one status, add href to trigger element - Increase tippy [interactiveBorder](https://atomiks.github.io/tippyjs/v6/all-props/#interactiveborder), making it easier to keep interactive tooltips open with sloppy mouse movement - Fix a overflow issue in the commit list Commit list before: <img width="459" alt="Screen Shot 2022-09-09 at 19 00 01" src="https://user-images.githubusercontent.com/115237/189405517-68de5a69-e312-4ea2-ab81-87629db6064b.png"> Commit List after: <img width="475" alt="Screen Shot 2022-09-09 at 19 01 43" src="https://user-images.githubusercontent.com/115237/189405574-13e84885-9073-4f86-9eeb-d008c1639647.png"> Co-authored-by: 6543 <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 0bd5938 commit 52cbe2b

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

templates/repo/commit_statuses.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<a class="ui link commit-statuses-trigger vm">{{template "repo/commit_status" .Status}}</a>
1+
<a class="ui link commit-statuses-trigger vm"{{if eq (len .Statuses) 1}}{{$status := index .Statuses 0}}{{if $status.TargetURL}} href="{{$status.TargetURL}}"{{end}}{{end}}>{{template "repo/commit_status" .Status}}</a>
22
<div class="ui commit-statuses-popup commit-statuses tippy-target">
33
<div class="ui relaxed list divided">
44
{{range .Statuses}}

web_src/js/features/repo-commit.js

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export function initCommitStatuses() {
6161
const top = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0;
6262

6363
createTippy(this, {
64-
trigger: 'click',
6564
content: this.nextElementSibling,
6665
placement: top ? 'top-start' : 'bottom-start',
6766
interactive: true,

web_src/js/modules/tippy.js

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export function createTippy(target, opts = {}) {
66
placement: target.getAttribute('data-placement') || 'top-start',
77
animation: false,
88
allowHTML: false,
9+
interactiveBorder: 30,
10+
ignoreAttributes: true,
911
maxWidth: 500, // increase over default 350px
1012
arrow: `<svg width="16" height="7"><path d="m0 7 8-7 8 7Z" class="tippy-svg-arrow-outer"/><path d="m0 8 8-7 8 7Z" class="tippy-svg-arrow-inner"/></svg>`,
1113
...(opts?.role && {theme: opts.role}),

web_src/less/_repository.less

+5
Original file line numberDiff line numberDiff line change
@@ -2827,6 +2827,11 @@ tbody.commit-list {
28272827
vertical-align: middle;
28282828
}
28292829

2830+
// in the commit list, messages can wrap so we can use inline
2831+
.commit-list .message-wrapper {
2832+
display: inline;
2833+
}
2834+
28302835
@media @mediaSm {
28312836
tr.commit-list {
28322837
width: 100%;

0 commit comments

Comments
 (0)