Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: split menu entries into mobileEntries.js
Signed-off-by: Luka Trovic <[email protected]>
  • Loading branch information
luka-nextcloud committed Jul 6, 2022
commit 44eba0f233f4b54078daf70fbc921fa0b65054be
42 changes: 38 additions & 4 deletions src/components/Menu/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,26 @@
<HelpModal v-if="displayHelp" @close="hideHelp" />

<div v-if="$isRichEditor" ref="menubar" class="text-menubar__entries">
<ActionEntry v-for="actionEntry of visibleEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
<template v-if="!isMobile">
<ActionEntry v-for="actionEntry of visibleEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
</template>
<template v-else>
<div class="top">
<ActionEntry v-for="actionEntry of topEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
</div>
<div class="bottom">
<ActionEntry v-for="actionEntry of bottomEntries"
v-bind="{ actionEntry }"
:key="`text-action--${actionEntry.key}`"
@call:help="showHelp" />
</div>
</template>
</div>
<div class="text-menubar__slot">
<slot />
Expand All @@ -50,13 +66,15 @@ import debounce from 'debounce'

import HelpModal from '../HelpModal.vue'
import actionsFullEntries from './entries.js'
import mobileEntries from './mobileEntries.js'
import ActionEntry from './ActionEntry.js'
import { DotsHorizontal } from '../icons.js'
import {
useEditorMixin,
useIsRichEditorMixin,
useIsRichWorkspaceMixin,
} from '../EditorWrapper.provider.js'
import isMobile from '../../mixins/isMobile.js'

export default {
name: 'MenuBar',
Expand All @@ -65,6 +83,7 @@ export default {
useEditorMixin,
useIsRichEditorMixin,
useIsRichWorkspaceMixin,
isMobile,
],
props: {
autohide: {
Expand Down Expand Up @@ -128,6 +147,12 @@ export default {
return priority !== undefined && priority > this.iconsLimit
})
},
topEntries() {
return [...mobileEntries].filter(({ position }) => position === 'top')
},
bottomEntries() {
return [...mobileEntries].filter(({ position }) => position === 'bottom')
},
remainAction() {
return {
key: 'remain',
Expand Down Expand Up @@ -261,8 +286,17 @@ export default {
@media (max-width: 660px) {
.text-menubar__entries {
margin-left: 0;
}

.top {
display: flex;
}

.bottom {
display: flex;
position: fixed;
top: calc(100vh - 100px);
left: 0;
}
}
}
Expand Down
Loading