Skip to content

Commit

Permalink
Remove this from VGridSkeleton props default (#3341)
Browse files Browse the repository at this point in the history
Co-authored-by: Olga Bulat <[email protected]>
  • Loading branch information
Ashhar-24 and obulat authored Nov 13, 2023
1 parent 37072c9 commit 9793ad3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions frontend/src/components/VSkeleton/VGridSkeleton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* Display placeholder elements while waiting for the actual elements to be
* loaded in the results views.
*/
import { defineComponent, PropType } from "vue"
import { computed, defineComponent, PropType } from "vue"
import type { SupportedSearchType } from "~/constants/media"
Expand All @@ -44,19 +44,22 @@ export default defineComponent({
},
numElems: {
type: Number,
default: function () {
if (this.isForTab === "all") return 20
if (this.isForTab === "image") return 30
return 8
},
},
},
setup() {
setup(props) {
function getRandomSize(max = 300, min = 100) {
return Math.floor(Math.random() * (max - min) + min)
}
return { getRandomSize }
const elementCount = computed(() => {
// Calculate the default element count based on isForTab
if (props.numElems) return props.numElems
if (props.isForTab === "all") return 20
if (props.isForTab === "image") return 30
return 8
})
return { getRandomSize, elementCount }
},
})
</script>
Expand Down

0 comments on commit 9793ad3

Please sign in to comment.