Skip to content

Commit

Permalink
Merge pull request #40583 from nextcloud/feat/button-mtime
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv committed Sep 28, 2023
2 parents c9ed1e9 + 25e500b commit cdd0790
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 24 deletions.
19 changes: 19 additions & 0 deletions apps/files/src/components/FileEntry.vue
Expand Up @@ -164,6 +164,7 @@
<!-- Mtime -->
<td v-if="isMtimeAvailable"
:style="{ opacity: mtimeOpacity }"
class="files-list__row-mtime"
data-cy-files-list-row-mtime
@click="openDetailsIfAvailable">
Expand Down Expand Up @@ -389,6 +390,24 @@ export default Vue.extend({
}
return this.t('files_trashbin', 'A long time ago')
},
mtimeOpacity() {
// Whatever theme is active, the contrast will pass WCAG AA
// with color main text over main background and an opacity of 0.7
const minOpacity = 0.7
const maxOpacityTime = 31 * 24 * 60 * 60 * 1000 // 31 days
const mtime = this.source.mtime?.getTime?.()
if (!mtime) {
return minOpacity
}
// 1 = today, 0 = 31 days ago
const factor = (maxOpacityTime - (Date.now() - mtime)) / maxOpacityTime
if (factor < 0) {
return minOpacity
}
return minOpacity + (1 - minOpacity) * factor
},
mtimeTitle() {
if (this.source.mtime) {
return moment(this.source.mtime).format('LLL')
Expand Down
1 change: 1 addition & 0 deletions apps/files/src/components/FilesListHeaderButton.vue
Expand Up @@ -22,6 +22,7 @@
<template>
<NcButton :aria-label="sortAriaLabel(name)"
:class="{'files-list__column-sort-button--active': sortingMode === mode}"
:alignment="mode !== 'size' ? 'start-reverse' : ''"
class="files-list__column-sort-button"
type="tertiary"
@click.stop.prevent="toggleSortBy(mode)">
Expand Down
11 changes: 1 addition & 10 deletions apps/files/src/components/FilesListTableHeaderButton.vue
Expand Up @@ -22,6 +22,7 @@
<template>
<NcButton :aria-label="sortAriaLabel(name)"
:class="{'files-list__column-sort-button--active': sortingMode === mode}"
:alignment="mode !== 'size' ? 'start-reverse' : ''"
class="files-list__column-sort-button"
type="tertiary"
@click.stop.prevent="toggleSortBy(mode)">
Expand Down Expand Up @@ -85,16 +86,6 @@ export default Vue.extend({
.files-list__column-sort-button {
// Compensate for cells margin
margin: 0 calc(var(--cell-margin) * -1);
// Reverse padding
padding: 0 4px 0 16px !important;
// Icon after text
.button-vue__wrapper {
flex-direction: row-reverse;
// Take max inner width for text overflow ellipsis
// Remove when https://github.com/nextcloud/nextcloud-vue/pull/3936 is merged
width: 100%;
}
.button-vue__icon {
transition-timing-function: linear;
Expand Down
16 changes: 5 additions & 11 deletions apps/files/src/components/FilesListVirtual.vue
Expand Up @@ -475,19 +475,13 @@ export default Vue.extend({
.files-list__row-mtime,
.files-list__row-size {
// Right align text
justify-content: flex-end;
width: calc(var(--row-height) * 1.5);
// opacity varies with the size
color: var(--color-main-text);
// Icon is before text since size is right aligned
.files-list__column-sort-button {
padding: 0 16px 0 4px !important;
.button-vue__wrapper {
flex-direction: row;
}
}
}
.files-list__row-size {
width: calc(var(--row-height) * 1.5);
// Right align content/text
justify-content: flex-end;
}
.files-list__row-mtime {
Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

0 comments on commit cdd0790

Please sign in to comment.