mirror of
https://github.com/zammad/zammad
synced 2026-05-24 09:48:36 +00:00
22 lines
636 B
TypeScript
22 lines
636 B
TypeScript
// Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/
|
|
|
|
import { useWindowSize } from '@vueuse/core'
|
|
import { computed, type ComputedRef, type Ref } from 'vue'
|
|
|
|
export const useSkeletonLoadingCount = (
|
|
count: Ref<number | undefined> | ComputedRef<number | undefined>,
|
|
) => {
|
|
const { height: screenHeight } = useWindowSize()
|
|
|
|
const visibleSkeletonLoadingCount = computed(() => {
|
|
const maxVisibleRowCount = Math.ceil(screenHeight.value / 40)
|
|
|
|
if (count.value && count.value > maxVisibleRowCount) return maxVisibleRowCount
|
|
|
|
return count.value
|
|
})
|
|
|
|
return {
|
|
visibleSkeletonLoadingCount,
|
|
}
|
|
}
|