Skip to content

Commit

Permalink
Merge pull request #882 from nextcloud-libraries/fix/mobile-filepicker
Browse files Browse the repository at this point in the history
FilePicker: Navigation and filter should be on separate rows on mobile
  • Loading branch information
susnux committed Aug 10, 2023
2 parents 2c0a86d + 046f789 commit 6b44dce
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 6 deletions.
6 changes: 3 additions & 3 deletions l10n/messages.pot
Expand Up @@ -26,11 +26,11 @@ msgstr ""
msgid "Copy"
msgstr ""

#: lib/components/FilePicker/FilePicker.vue:212
#: lib/components/FilePicker/FilePicker.vue:213
msgid "Could not create the new folder"
msgstr ""

#: lib/components/FilePicker/FilePicker.vue:135
#: lib/components/FilePicker/FilePicker.vue:136
#: lib/components/FilePicker/FilePickerNavigation.vue:65
msgid "Favorites"
msgstr ""
Expand All @@ -51,7 +51,7 @@ msgstr ""
msgid "Name"
msgstr ""

#: lib/components/FilePicker/FilePicker.vue:135
#: lib/components/FilePicker/FilePicker.vue:136
#: lib/components/FilePicker/FilePickerNavigation.vue:61
msgid "Recent"
msgstr ""
Expand Down
18 changes: 17 additions & 1 deletion lib/components/DialogBase.vue
Expand Up @@ -7,7 +7,7 @@
{{ props.name }}
</h2>
<!-- When the navigation is collapsed (too small dialog) it is displayed above the main content, otherwise on the inline start -->
<nav v-if="hasNavigation" class="dialog__navigation">
<nav v-if="hasNavigation" :class="['dialog__navigation', ...navigationClasses]">
<slot name="navigation" :is-collapsed="isNavigationCollapsed" />
</nav>
<!-- Man dialog content -->
Expand Down Expand Up @@ -61,11 +61,27 @@ const props = withDefaults(defineProps<{
* @default []
*/
buttons?: readonly IDialogButton[]
/**
* Optionally pass additionaly classes which will be set on the navigation for custom styling
* @default []
* @example
* ```html
* <DialogBase :navigation-classes="['mydialog-navigation']"><!-- --></DialogBase>
* <!-- ... -->
* <style lang="scss">
* :deep(.mydialog-navigation) {
* flex-direction: row-reverse;
* }
* </style>
* ```
*/
navigationClasses?: string[]
}>(), {
size: 'normal',
container: 'body',
message: '',
buttons: () => [],
navigationClasses: () => [],
})
const emit = defineEmits<{
Expand Down
1 change: 1 addition & 0 deletions lib/components/FilePicker/FilePicker.vue
Expand Up @@ -111,6 +111,7 @@ const dialogProps = computed(() => ({
name: props.name,
buttons: dialogButtons.value,
size: 'large',
navigationClasses: ['file-picker__navigation'],
}))
/**
Expand Down
30 changes: 28 additions & 2 deletions lib/components/FilePicker/FilePickerNavigation.vue
Expand Up @@ -122,9 +122,35 @@ const updateFilterValue = (value: string) => emit('update:filterString', value)
}
}
}
@media (max-width: 512px) {
.file-picker {
&__side {
flex-direction: row;
min-width: unset;
}
&__filter-input {
max-width: unset;
}
}
}
</style>

<style>
.file-picker__navigation .v-select.select {
min-width: 220px;
}
@media (min-width: 513px) and (max-width: 736px) {
.file-picker__navigation {
gap: 11px;
}
}
:deep(.dialog__navigation .v-select.select) {
min-width: 160px;
@media (max-width: 512px) {
.file-picker__navigation {
flex-direction: column-reverse!important;
}
}
</style>

0 comments on commit 6b44dce

Please sign in to comment.