bug fix: calcHeight

This commit is contained in:
Jeffrey Hsu 2025-01-14 14:53:44 +08:00
parent 79c25ef7a7
commit ecaad4e62a

View File

@ -50,7 +50,16 @@ const props = defineProps<{
return `${years} 年前` return `${years} 年前`
}, },
calcHeight = (n: number) => `${n * 2.5}rem` calcHeight = (n: number) => {
/*
* Content:
* text-base: 1rem
* my-2: 1rem (0.5 + 0.5)
* Compare URL:
* text-base: 1rem
* */
return `${2 * n + (n > 1 ? 2 : 0)}rem`
}
</script> </script>
<template> <template>
@ -76,7 +85,7 @@ const props = defineProps<{
<div <div
v-if="commit.content" v-if="commit.content"
class="ml-14 overflow-hidden transition-all duration-500 lg:invisible lg:opacity-0 class="ml-14 overflow-hidden transition-all duration-500 lg:invisible lg:opacity-0
lg:h-0 lg:group-hover:h-[999px] lg:group-hover:visible lg:group-hover:opacity-100" lg:h-0 lg:group-hover:h-80 lg:group-hover:visible lg:group-hover:opacity-100"
:style="{ maxHeight: calcHeight(commit.content.Commits.length) }" :style="{ maxHeight: calcHeight(commit.content.Commits.length) }"
> >
<div <div