aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-03-19 16:32:33 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2024-03-19 20:10:19 +0100
commite245c3df12e956d10004ae62db5f7a60c08d6a3b (patch)
tree9b61d8b3b862ed53e3941688af8d9b61bcad4efa /apps/settings
parent83746f7049b3c84b0c1fb4092ecba141d6993531 (diff)
downloadnextcloud-server-e245c3df12e956d10004ae62db5f7a60c08d6a3b.tar.gz
nextcloud-server-e245c3df12e956d10004ae62db5f7a60c08d6a3b.zip
fix(settings): Make App Discover PostType responsive based on available width
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/settings')
-rw-r--r--apps/settings/src/components/AppStoreDiscover/PostType.vue26
1 files changed, 21 insertions, 5 deletions
diff --git a/apps/settings/src/components/AppStoreDiscover/PostType.vue b/apps/settings/src/components/AppStoreDiscover/PostType.vue
index 626e4e80fe5..c5b5d1cfc03 100644
--- a/apps/settings/src/components/AppStoreDiscover/PostType.vue
+++ b/apps/settings/src/components/AppStoreDiscover/PostType.vue
@@ -21,8 +21,12 @@
-->
<template>
<article :id="domId"
+ ref="container"
class="app-discover-post"
- :class="{ 'app-discover-post--reverse': media && media.alignment === 'start' }">
+ :class="{
+ 'app-discover-post--reverse': media && media.alignment === 'start',
+ 'app-discover-post--small': isSmallWidth
+ }">
<component :is="link ? 'AppLink' : 'div'"
v-if="headline || text"
:href="link"
@@ -73,7 +77,7 @@ import type { PropType } from 'vue'
import { mdiPlayCircleOutline } from '@mdi/js'
import { generateUrl } from '@nextcloud/router'
-import { useElementVisibility } from '@vueuse/core'
+import { useElementSize, useElementVisibility } from '@vueuse/core'
import { computed, defineComponent, ref, watchEffect } from 'vue'
import { commonAppDiscoverProps } from './common'
import { useLocalizedValue } from '../../composables/useGetLocalizedValue'
@@ -139,6 +143,14 @@ export default defineComponent({
const showPlayVideo = computed(() => localizedMedia.value?.link && hasPlaybackEnded.value)
/**
+ * The content is sized / styles are applied based on the container width
+ * To make it responsive even for inline usage and when opening / closing the sidebar / navigation
+ */
+ const container = ref<HTMLElement>()
+ const { width: containerWidth } = useElementSize(container)
+ const isSmallWidth = computed(() => containerWidth.value < 600)
+
+ /**
* Generate URL for cached media to prevent user can be tracked
* @param url The URL to resolve
*/
@@ -171,6 +183,8 @@ export default defineComponent({
return {
mdiPlayCircleOutline,
+ container,
+
translatedText,
translatedHeadline,
mediaElement,
@@ -182,6 +196,7 @@ export default defineComponent({
showPlayVideo,
isFullWidth,
+ isSmallWidth,
isImage,
generatePrivacyUrl,
@@ -264,16 +279,17 @@ export default defineComponent({
}
}
-// Ensure section works on mobile devices
-@media only screen and (max-width: 699px) {
- .app-discover-post {
+.app-discover-post--small {
+ &.app-discover-post {
flex-direction: column;
max-height: 500px;
&--reverse {
flex-direction: column-reverse;
}
+ }
+ .app-discover-post {
&__text {
flex: 1 1 50%;
}