From 34d22f19d3b15bf5a10ba4977288e6c285aba36b Mon Sep 17 00:00:00 2001
From: John Molakvoæ <skjnldsv@protonmail.com>
Date: Fri, 7 Apr 2023 13:32:11 +0200
Subject: feat(files): responsive design for mobile and narrow screens
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
---
 .../src/components/FilesListHeaderActions.vue      | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

(limited to 'apps/files/src/components/FilesListHeaderActions.vue')

diff --git a/apps/files/src/components/FilesListHeaderActions.vue b/apps/files/src/components/FilesListHeaderActions.vue
index f136e281f09..13e24ec77e6 100644
--- a/apps/files/src/components/FilesListHeaderActions.vue
+++ b/apps/files/src/components/FilesListHeaderActions.vue
@@ -1,7 +1,7 @@
 <!--
-  - @copyright Copyright (c) 2019 Gary Kim <gary@garykim.dev>
+  - @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
   -
-  - @author Gary Kim <gary@garykim.dev>
+  - @author John Molakvoæ <skjnldsv@protonmail.com>
   -
   - @license GNU AGPL version 3 or any later version
   -
@@ -24,7 +24,8 @@
 		<NcActions ref="actionsMenu"
 			:disabled="!!loading || areSomeNodesLoading"
 			:force-title="true"
-			:inline="3"
+			:inline="inlineActions"
+			:menu-title="inlineActions === 0 ? t('files', 'Actions') : null"
 			:open.sync="openedMenu">
 			<NcActionButton v-for="action in enabledActions"
 				:key="action.id"
@@ -43,8 +44,8 @@
 <script lang="ts">
 import { showError, showSuccess } from '@nextcloud/dialogs'
 import { translate } from '@nextcloud/l10n'
-import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
 import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
+import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
 import NcLoadingIcon from '@nextcloud/vue/dist/Components/NcLoadingIcon.js'
 import Vue from 'vue'
 
@@ -52,6 +53,7 @@ import { getFileActions } from '../services/FileAction.ts'
 import { useActionsMenuStore } from '../store/actionsmenu.ts'
 import { useFilesStore } from '../store/files.ts'
 import { useSelectionStore } from '../store/selection.ts'
+import clientWidthMixin from '../mixins/clientWidth.ts'
 import CustomSvgIconRender from './CustomSvgIconRender.vue'
 import logger from '../logger.js'
 
@@ -68,6 +70,10 @@ export default Vue.extend({
 		NcLoadingIcon,
 	},
 
+	mixins: [
+		clientWidthMixin,
+	],
+
 	props: {
 		currentView: {
 			type: Object,
@@ -122,6 +128,16 @@ export default Vue.extend({
 				this.actionsMenuStore.opened = opened ? 'global' : null
 			},
 		},
+
+		inlineActions() {
+			if (this.clientWidth < 480) {
+				return 1
+			}
+			if (this.clientWidth < 768) {
+				return 2
+			}
+			return 3
+		},
 	},
 
 	methods: {
-- 
cgit v1.2.3

