Skip to content

Commit 1f00bc4

Browse files
authored
Fix review UI (#27322)
Close #26730 1. The `diff-detail-box` was abused, it shouldn't be used for "DiffFileList/DiffFileTree". 2. Fix the sticky position for various screens. ![image](https://github.com/go-gitea/gitea/assets/2114189/558a5c06-c94c-4e5c-8395-d38473dd21c2) ![image](https://github.com/go-gitea/gitea/assets/2114189/3390fb0e-7dc7-457f-bd0c-398fdb6d24c0) ![image](https://github.com/go-gitea/gitea/assets/2114189/d19dd350-aecf-4909-8ef9-73b09d94560e)
1 parent 72c6817 commit 1f00bc4

File tree

4 files changed

+12
-17
lines changed

4 files changed

+12
-17
lines changed

templates/repo/diff/box.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div>
2-
<div class="diff-detail-box diff-box sticky gt-df gt-sb gt-ac">
2+
<div class="diff-detail-box diff-box">
33
<div class="gt-df gt-ac gt-fw">
44
{{if not .DiffNotAvailable}}
55
<button class="diff-toggle-file-tree-button gt-df gt-ac not-mobile" data-show-text="{{ctx.Locale.Tr "repo.diff.show_file_tree"}}" data-hide-text="{{ctx.Locale.Tr "repo.diff.hide_file_tree"}}">

web_src/css/repo.css

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,14 +1502,21 @@
15021502
}
15031503

15041504
.repository .diff-detail-box {
1505+
display: flex;
1506+
justify-content: space-between;
1507+
align-items: center;
1508+
position: sticky;
1509+
top: 0;
1510+
z-index: 8;
15051511
padding: 7px 0;
1512+
height: 44px; /* this height should match sticky-2nd-row */
15061513
background: var(--color-body);
15071514
}
15081515

15091516
@media (max-width: 991.98px) {
15101517
.repository .diff-detail-box {
15111518
flex-direction: row;
1512-
align-items: flex-start;
1519+
height: 77px; /* this height should match sticky-2nd-row */
15131520
}
15141521
}
15151522

@@ -1518,18 +1525,6 @@
15181525
flex-wrap: wrap;
15191526
}
15201527
}
1521-
1522-
.repository .diff-detail-box.sticky {
1523-
position: sticky;
1524-
top: 0;
1525-
z-index: 8;
1526-
border-bottom: none;
1527-
padding-left: 5px;
1528-
padding-right: 5px;
1529-
margin-left: -4px;
1530-
margin-right: -4px;
1531-
}
1532-
15331528
.repository .diff-detail-box .diff-detail-stats strong {
15341529
margin-left: 0.25rem;
15351530
margin-right: 0.25rem;
@@ -2830,7 +2825,7 @@ tbody.commit-list {
28302825

28312826
.ui.attached.header.diff-file-header.sticky-2nd-row {
28322827
position: sticky;
2833-
top: 47px; /* match .repository .diff-detail-box */
2828+
top: 44px; /* match .repository .diff-detail-box */
28342829
z-index: 7;
28352830
}
28362831

web_src/js/components/DiffFileList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
};
3737
</script>
3838
<template>
39-
<ol class="diff-detail-box diff-stats gt-m-0" ref="root" v-if="store.fileListIsVisible">
39+
<ol class="diff-stats gt-m-0" ref="root" v-if="store.fileListIsVisible">
4040
<li v-for="file in store.files" :key="file.NameHash">
4141
<div class="gt-font-semibold gt-df gt-ac pull-right">
4242
<span v-if="file.IsBin" class="gt-ml-1 gt-mr-3">{{ store.binaryFileMessage }}</span>

web_src/js/components/DiffFileTree.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default {
126126
};
127127
</script>
128128
<template>
129-
<div v-if="store.fileTreeIsVisible" class="gt-mr-3 gt-mt-3 diff-detail-box">
129+
<div v-if="store.fileTreeIsVisible" class="gt-mr-3">
130130
<!-- only render the tree if we're visible. in many cases this is something that doesn't change very often -->
131131
<DiffFileTreeItem v-for="item in fileTree" :key="item.name" :item="item"/>
132132
<div v-if="store.isIncomplete" class="gt-pt-2">

0 commit comments

Comments
 (0)