Skip to content

Commit c2bd863

Browse files
silverwind6543
authored andcommitted
Improve diff tree spacing (go-gitea#27714)
1. Un-indent top-level items, matching GitHub rendering 2. Increase item padding and add 1px gap between items Before and After: <img width="247" alt="Screenshot 2023-10-20 at 18 37 32" src="https://github.com/go-gitea/gitea/assets/115237/43c1ce86-1814-4a8a-9dd2-0c4a82a2be7c"> <img width="241" alt="Screenshot 2023-10-20 at 18 40 46" src="https://github.com/go-gitea/gitea/assets/115237/b541b85b-c428-4903-becd-773ae5807495"> --------- Co-authored-by: 6543 <[email protected]>
1 parent 014f98e commit c2bd863

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

web_src/js/components/DiffFileTree.vue

+9-1
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,19 @@ export default {
126126
};
127127
</script>
128128
<template>
129-
<div v-if="store.fileTreeIsVisible" class="gt-mr-3">
129+
<div v-if="store.fileTreeIsVisible" class="diff-file-tree-items">
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">
133133
<a :class="['ui', 'basic', 'tiny', 'button', store.isLoadingNewData ? 'disabled' : '']" @click.stop="loadMoreData">{{ store.showMoreMessage }}</a>
134134
</div>
135135
</div>
136136
</template>
137+
<style scoped>
138+
.diff-file-tree-items {
139+
display: flex;
140+
flex-direction: column;
141+
gap: 1px;
142+
margin-right: .5rem;
143+
}
144+
</style>

web_src/js/components/DiffFileTreeItem.vue

+7-4
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,14 @@ a, a:hover {
5858
}
5959
6060
.sub-items {
61-
padding-left: 9px;
61+
display: flex;
62+
flex-direction: column;
63+
gap: 1px;
64+
padding-left: 8px;
6265
}
6366
64-
.item-file {
65-
margin-left: 20px;
67+
.sub-items .item-file {
68+
padding-left: 24px;
6669
}
6770
6871
.item-file.selected {
@@ -80,7 +83,7 @@ a, a:hover {
8083
display: flex;
8184
align-items: center;
8285
gap: 0.25em;
83-
padding: 2px;
86+
padding: 3px 6px;
8487
}
8588
8689
.item-file:hover,

0 commit comments

Comments
 (0)