Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 6 additions & 4 deletions Tekst-Web/src/components/CollapsibleContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ import { computed, nextTick, ref } from 'vue';
const props = withDefaults(
defineProps<{
collapsible?: boolean;
heightTreshPx?: number;
collapsedHeight?: number;
collapseText?: string;
expandText?: string;
showBtnText?: boolean;
}>(),
{
collapsible: true,
heightTreshPx: 150,
collapsedHeight: 300,
showBtnText: true,
}
);
Expand All @@ -23,7 +23,9 @@ const contentRef = ref<HTMLElement>();
const containerRef = ref<HTMLElement>();
const { height } = useElementSize(contentRef);
const collapsed = defineModel<boolean>({ required: false, default: true });
const isCollapsible = computed(() => props.collapsible && height.value > props.heightTreshPx);
const isCollapsible = computed(
() => props.collapsible && height.value > props.collapsedHeight * 1.5
);
const isCollapsed = computed(() => isCollapsible.value && collapsed.value);

async function toggleCollapse(collapse: boolean) {
Expand All @@ -41,7 +43,7 @@ async function toggleCollapse(collapse: boolean) {
<div
:class="{ collapsed: isCollapsed }"
:style="{
maxHeight: isCollapsed ? `${heightTreshPx}px` : undefined,
maxHeight: isCollapsed ? `${collapsedHeight}px` : undefined,
overflow: 'hidden',
}"
>
Expand Down
2 changes: 1 addition & 1 deletion Tekst-Web/src/components/browse/ContentContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ watch(
v-if="hasContents"
:collapsible="collapsible || contentContextLoaded"
:collapsed="collapsed"
:height-tresh-px="resource.config.general.collapsibleContents || undefined"
:collapsed-height="resource.config.general.collapsibleContents || undefined"
class="content-loadable"
:class="{ 'content-loading': loading }"
>
Expand Down
2 changes: 1 addition & 1 deletion Tekst-Web/src/components/search/SearchResult.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const highlightsProcessed = computed<HighlightDisplayData[]>(() => {
<template>
<n-list-item style="padding: 0">
<collapsible-content
:height-tresh-px="smallScreen ? 250 : 420"
:collapsed-height="smallScreen ? 250 : 420"
:show-btn-text="!smallScreen"
class="mb-sm"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const metadataKeysOptions = computed(() =>

<!-- DESCRIPTION -->
<form-section :title="$t('common.description')">
<collapsible-content :height-tresh-px="240">
<collapsible-content :collapsed-height="240">
<translation-form-item
v-model="model.description"
input-type="html"
Expand Down