Skip to content

Commit 7f3abbe

Browse files
committed
feat(files): responsive design for mobile and narrow screens
Signed-off-by: John Molakvoæ <[email protected]>
1 parent 81b93ef commit 7f3abbe

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

apps/files/src/components/FileEntry.vue

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
112112
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
113113
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js'
114114
import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
115+
import isMobileMixin from '@nextcloud/vue/dist/Mixins/isMobile.js'
115116
import Vue from 'vue'
116117
117118
import { isCachedPreview } from '../services/PreviewService.ts'
@@ -141,6 +142,10 @@ export default Vue.extend({
141142
NcLoadingIcon,
142143
},
143144
145+
mixins: [
146+
isMobileMixin,
147+
],
148+
144149
props: {
145150
active: {
146151
type: Boolean,
@@ -285,13 +290,20 @@ export default Vue.extend({
285290
},
286291
287292
enabledInlineActions() {
293+
if (this.isMobile) {
294+
return []
295+
}
288296
return this.enabledActions.filter(action => action?.inline?.(this.source, this.currentView))
289297
},
290298
291299
enabledMenuActions() {
300+
if (this.isMobile) {
301+
return this.enabledActions
302+
}
303+
292304
return [
293305
...this.enabledInlineActions,
294-
...actions.filter(action => !action.inline),
306+
...this.enabledActions.filter(action => !action.inline),
295307
]
296308
},
297309

apps/files/src/components/FilesListVirtual.vue

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ export default Vue.extend({
225225
// Show same padding as the checkbox right padding for visual balance
226226
margin-right: var(--checkbox-padding);
227227
color: var(--color-primary-element);
228+
// No shrinking or growing allowed
229+
flex: 0 0 var(--icon-preview-size);
228230
229231
& > span {
230232
justify-content: flex-start;
@@ -284,7 +286,7 @@ export default Vue.extend({
284286
margin: 0 var(--cell-margin);
285287
}
286288
287-
& > button {
289+
button {
288290
.button-vue__text {
289291
// Remove bold from default button styling
290292
font-weight: normal;
@@ -315,7 +317,22 @@ export default Vue.extend({
315317
.files-list__row-column-custom {
316318
width: calc(var(--row-height) * 2);
317319
}
320+
321+
@media (max-width: 768px) {
322+
// Hide any column after the size menu on mobile
323+
.files-list__row-size ~ td,
324+
.files-list__row-size ~ th {
325+
display: none;
326+
}
327+
}
328+
329+
@media (max-width: 480px) {
330+
// Hide any column after the actions menu on short mobile
331+
.files-list__row-actions ~ td,
332+
.files-list__row-actions ~ th {
333+
display: none;
334+
}
335+
}
318336
}
319337
}
320-
321338
</style>

0 commit comments

Comments
 (0)