Skip to content

Commit

Permalink
fix: the description of an album could be null
Browse files Browse the repository at this point in the history
  • Loading branch information
Clarkkkk committed Jan 18, 2024
1 parent d22ab5c commit 5057278
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/pages/Album/components/Info.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref } from 'vue'
import { computed, ref } from 'vue'
import { useMediaQuery } from '@vueuse/core'
import type { ApiAlbum } from 'api'
import { Collapsible, Image } from 'components'
Expand All @@ -9,11 +9,14 @@ interface InfoProps {
info: ApiAlbum['return']['album'] | null
}
defineProps<InfoProps>()
const props = defineProps<InfoProps>()
const modal = ref<InstanceType<typeof Image> | null>(null)
const lessThan768 = useMediaQuery('(max-width: 767px)')
const lessThan1280 = useMediaQuery('(max-width: 1279px)')
const collapsible = computed(() => {
return (props.info?.description?.length || 0) > (lessThan768 ? 150 : lessThan1280 ? 300 : 400)
})
</script>

<template>
Expand Down Expand Up @@ -91,9 +94,7 @@ const lessThan1280 = useMediaQuery('(max-width: 1279px)')
</span>
</div>
<Collapsible
:collapsible="
(info?.description.length || 0) > (lessThan768 ? 150 : lessThan1280 ? 300 : 400)
"
:collapsible="collapsible"
:collapse-height="lessThan768 ? 97 : 110"
:possible-max-height="lessThan1280 ? 500 : 1000"
>
Expand Down

0 comments on commit 5057278

Please sign in to comment.