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
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">
3741import { translate } from ' @nextcloud/l10n'
42+ import { defineComponent } from ' vue'
43+
3844import MenuDown from ' vue-material-design-icons/MenuDown.vue'
3945import MenuUp from ' vue-material-design-icons/MenuUp.vue'
4046import NcButton from ' @nextcloud/vue/dist/Components/NcButton.js'
41- import Vue from ' vue'
4247
4348import 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 >
0 commit comments