Skip to content

Commit 54e08f4

Browse files
feat: split menu entries into mobileEntries.js
Signed-off-by: Luka Trovic <luka@nextcloud.com>
1 parent 7946260 commit 54e08f4

2 files changed

Lines changed: 391 additions & 4 deletions

File tree

src/components/Menu/MenuBar.vue

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,26 @@
3333
<HelpModal v-if="displayHelp" @close="hideHelp" />
3434

3535
<div v-if="$isRichEditor" ref="menubar" class="text-menubar__entries">
36-
<ActionEntry v-for="actionEntry of visibleEntries"
37-
v-bind="{ actionEntry }"
38-
:key="`text-action--${actionEntry.key}`"
39-
@call:help="showHelp" />
36+
<template v-if="!isMobile">
37+
<ActionEntry v-for="actionEntry of visibleEntries"
38+
v-bind="{ actionEntry }"
39+
:key="`text-action--${actionEntry.key}`"
40+
@call:help="showHelp" />
41+
</template>
42+
<template v-else>
43+
<div class="top">
44+
<ActionEntry v-for="actionEntry of topEntries"
45+
v-bind="{ actionEntry }"
46+
:key="`text-action--${actionEntry.key}`"
47+
@call:help="showHelp" />
48+
</div>
49+
<div class="bottom">
50+
<ActionEntry v-for="actionEntry of bottomEntries"
51+
v-bind="{ actionEntry }"
52+
:key="`text-action--${actionEntry.key}`"
53+
@call:help="showHelp" />
54+
</div>
55+
</template>
4056
</div>
4157
<div class="text-menubar__slot">
4258
<slot />
@@ -50,13 +66,15 @@ import debounce from 'debounce'
5066
5167
import HelpModal from '../HelpModal.vue'
5268
import actionsFullEntries from './entries.js'
69+
import mobileEntries from './mobileEntries.js'
5370
import ActionEntry from './ActionEntry.js'
5471
import { DotsHorizontal } from '../icons.js'
5572
import {
5673
useEditorMixin,
5774
useIsRichEditorMixin,
5875
useIsRichWorkspaceMixin,
5976
} from '../EditorWrapper.provider.js'
77+
import isMobile from '../../mixins/isMobile.js'
6078
6179
export default {
6280
name: 'MenuBar',
@@ -65,6 +83,7 @@ export default {
6583
useEditorMixin,
6684
useIsRichEditorMixin,
6785
useIsRichWorkspaceMixin,
86+
isMobile,
6887
],
6988
props: {
7089
autohide: {
@@ -128,6 +147,12 @@ export default {
128147
return priority !== undefined && priority > this.iconsLimit
129148
})
130149
},
150+
topEntries() {
151+
return [...mobileEntries].filter(({ position }) => position === 'top')
152+
},
153+
bottomEntries() {
154+
return [...mobileEntries].filter(({ position }) => position === 'bottom')
155+
},
131156
remainAction() {
132157
return {
133158
key: 'remain',
@@ -261,8 +286,17 @@ export default {
261286
@media (max-width: 660px) {
262287
.text-menubar__entries {
263288
margin-left: 0;
289+
}
290+
291+
.top {
292+
display: flex;
293+
}
294+
295+
.bottom {
296+
display: flex;
264297
position: fixed;
265298
top: calc(100vh - 100px);
299+
left: 0;
266300
}
267301
}
268302
}

0 commit comments

Comments
 (0)