Skip to content

Commit c13b748

Browse files
authored
Merge pull request #41710 from nextcloud/fix/files-table-header
fix(files): Adjust table header to look like on previous versions
2 parents b3e24a6 + 7809364 commit c13b748

File tree

4 files changed

+45
-39
lines changed

4 files changed

+45
-39
lines changed

apps/files/src/components/FilesListTableHeader.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
-
44
- @author John Molakvoæ <[email protected]>
55
-
6-
- @license GNU AGPL version 3 or any later version
6+
- @license AGPL-3.0-or-later
77
-
88
- This program is free software: you can redistribute it and/or modify
99
- it under the terms of the GNU Affero General Public License as
@@ -34,8 +34,7 @@
3434
<template v-else>
3535
<!-- Link to file -->
3636
<th class="files-list__column files-list__row-name files-list__column--sortable"
37-
:aria-sort="ariaSortForMode('basename')"
38-
@click.stop.prevent="toggleSortBy('basename')">
37+
:aria-sort="ariaSortForMode('basename')">
3938
<!-- Icon or preview -->
4039
<span class="files-list__row-icon" />
4140

apps/files/src/components/FilesListTableHeaderButton.vue

Lines changed: 40 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
- @copyright Copyright (c) 2023 John Molakvoæ <[email protected]>
33
-
44
- @author John Molakvoæ <[email protected]>
5+
- @author Ferdinand Thiessen <[email protected]>
56
-
6-
- @license GNU AGPL version 3 or any later version
7+
- @license AGPL-3.0-or-later
78
-
89
- This program is free software: you can redistribute it and/or modify
910
- it under the terms of the GNU Affero General Public License as
@@ -20,29 +21,33 @@
2021
-
2122
-->
2223
<template>
23-
<NcButton :aria-label="sortAriaLabel(name)"
24-
:class="{'files-list__column-sort-button--active': sortingMode === mode}"
25-
:alignment="mode !== 'size' ? 'start-reverse' : undefined"
26-
class="files-list__column-sort-button"
24+
<NcButton :class="['files-list__column-sort-button', {
25+
'files-list__column-sort-button--active': sortingMode === mode,
26+
'files-list__column-sort-button--size': sortingMode === 'size',
27+
}]"
28+
:aria-label="sortAriaLabel"
29+
:alignment="mode === 'size' ? 'end' : 'start-reverse'"
2730
type="tertiary"
28-
@click.stop.prevent="toggleSortBy(mode)">
29-
<!-- Sort icon before text as size is align right -->
30-
<MenuUp v-if="sortingMode !== mode || isAscSorting" slot="icon" />
31-
<MenuDown v-else slot="icon" />
32-
{{ name }}
31+
@click="toggleSortBy(mode)">
32+
<template #icon>
33+
<MenuUp v-if="sortingMode !== mode || isAscSorting" class="files-list__column-sort-button-icon" />
34+
<MenuDown v-else class="files-list__column-sort-button-icon" />
35+
</template>
36+
<span class="files-list__column-sort-button-text">{{ name }}</span>
3337
</NcButton>
3438
</template>
3539

3640
<script lang="ts">
3741
import { translate } from '@nextcloud/l10n'
42+
import { defineComponent } from 'vue'
43+
3844
import MenuDown from 'vue-material-design-icons/MenuDown.vue'
3945
import MenuUp from 'vue-material-design-icons/MenuUp.vue'
4046
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
41-
import Vue from 'vue'
4247
4348
import filesSortingMixin from '../mixins/filesSorting.ts'
4449
45-
export default Vue.extend({
50+
export default defineComponent({
4651
name: 'FilesListTableHeaderButton',
4752
4853
components: {
@@ -66,44 +71,46 @@ export default Vue.extend({
6671
},
6772
},
6873
69-
methods: {
70-
sortAriaLabel(column) {
74+
computed: {
75+
sortAriaLabel() {
7176
return this.t('files', 'Sort list by {column}', {
72-
column,
77+
column: this.name,
7378
})
7479
},
75-
80+
},
81+
methods: {
7682
t: translate,
7783
},
7884
})
7985
</script>
8086

81-
<style lang="scss">
87+
<style scoped lang="scss">
8288
.files-list__column-sort-button {
8389
// Compensate for cells margin
8490
margin: 0 calc(var(--cell-margin) * -1);
91+
min-width: calc(100% - 3 * var(--cell-margin))!important;
92+
93+
&-text {
94+
color: var(--color-text-maxcontrast);
95+
font-weight: normal;
96+
}
8597
86-
.button-vue__icon {
87-
transition-timing-function: linear;
88-
transition-duration: .1s;
89-
transition-property: opacity;
98+
&-icon {
99+
color: var(--color-text-maxcontrast);
90100
opacity: 0;
101+
transition: opacity var(--animation-quick);
102+
inset-inline-start: -10px;
91103
}
92104
93-
// Remove when https://github.com/nextcloud/nextcloud-vue/pull/3936 is merged
94-
.button-vue__text {
95-
overflow: hidden;
96-
white-space: nowrap;
97-
text-overflow: ellipsis;
105+
&--size &-icon {
106+
inset-inline-start: 10px;
98107
}
99108
100-
&--active,
101-
&:hover,
102-
&:focus,
103-
&:active {
104-
.button-vue__icon {
105-
opacity: 1 !important;
106-
}
109+
&--active &-icon,
110+
&:hover &-icon,
111+
&:focus &-icon,
112+
&:active &-icon {
113+
opacity: 1;
107114
}
108115
}
109116
</style>

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)