Skip to content

Commit 67836b0

Browse files
committed
fix: clamp title and description lines
Relates to #265
1 parent 903acf9 commit 67836b0

File tree

15 files changed

+43
-27
lines changed

15 files changed

+43
-27
lines changed

playground/components/OgImage/CustomFont.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ const theme = computed(() => props.themeColor || '#dbf4ff')
2121
<template>
2222
<div :style="{ fontFamily: 'optieinstein', fontWeight: 400, padding: '0 60px', width: '100%', height: '100%', backgroundColor: '#0c0c0c', backgroundImage: `linear-gradient(to bottom, ${theme}, #fff1f1)`, display: 'flex', alignItems: 'center' }">
2323
<div :style="{ padding: '0 30px', display: 'flex', flexDirection: 'column' }">
24-
<p :style="{ fontSize: '75px', fontWeight: 'bold', marginBottom: '20px' }">
24+
<p :style="{ fontSize: '75px', fontWeight: 'bold', marginBottom: '20px' }" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
2525
{{ title }}
2626
</p>
27-
<p :style="{ fontSize: '35px', fontWeight: 400 }">
27+
<p :style="{ fontSize: '35px', fontWeight: 400 }" style="display: block; line-clamp: 3; text-overflow: ellipsis;">
2828
{{ description }}
2929
</p>
3030
<p class="inline-style">

playground/components/OgImage/NuxtIcon.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,12 @@ const containerStyles = {
1919

2020
<template>
2121
<div :style="containerStyles">
22-
<div>{{ title }}</div>
23-
<div>{{ description }}</div>
22+
<div style="display: block; line-clamp: 2; text-overflow: ellipsis;">
23+
{{ title }}
24+
</div>
25+
<div style="display: block; line-clamp: 2; text-overflow: ellipsis;">
26+
{{ description }}
27+
</div>
2428
<Icon mode="svg" name="carbon:book" size="250px" class="size-30 text-blue-500/30" style="margin: 0 auto;" />
2529
<Icon name="carbon:star" size="250px" class="size-30 text-blue-500" style="margin: 0 auto;" />
2630
<Icon mode="svg" name="uil:github" size="250px" class="size-30 text-blue-500" style="margin: 0 auto;" />

playground/components/OgImage/Octopo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const isClass = computed(() => props.bgColor?.startsWith('bg-'))
1414
<template>
1515
<div class="w-full h-full flex text-white items-center justify-center" :class="isClass ? [bgColor || 'bg-blue-500'] : []" :style="{ backgroundColor: !isClass ? `#${bgColor}` : undefined }">
1616
{{ description }}
17-
<h1 :style="{ fontSize: '70px' }">
17+
<h1 :style="{ fontSize: '70px' }" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
1818
{{ title }}
1919
</h1>
2020
</div>

playground/components/OgImage/ScopedCss.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const theme = computed(() => props.themeColor || '#dbf4ff')
1616

1717
<template>
1818
<div class="main" :style="{ backgroundColor: theme }">
19-
<h1 class="underline">
19+
<h1 class="underline" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
2020
Hello World
2121
</h1>
2222
</div>

playground/components/OgImage/Tailwind.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const isClass = computed(() => props.bgColor?.startsWith('bg-'))
1313

1414
<template>
1515
<div class="w-full h-full flex text-white items-center justify-center" :class="isClass ? [bgColor || 'bg-blue-500'] : []" :style="{ backgroundColor: !isClass ? `#${bgColor}` : undefined }">
16-
<h1 :style="{ fontSize: '70px' }">
16+
<h1 :style="{ fontSize: '70px' }" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
1717
{{ title }}
1818
</h1>
1919
</div>

src/runtime/app/components/Templates/Community/BrandedLogo.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ withDefaults(defineProps<{
2020
<div class="flex items-start justify-start h-full">
2121
<div class="flex flex-col justify-between w-full h-full p-20">
2222
<img :src="logo" height="50">
23-
<h1 class="text-[60px] text-white font-bold text-left">
23+
<h1 class="text-[60px] text-white font-bold text-left" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
2424
{{ title }}
2525
</h1>
2626
</div>

src/runtime/app/components/Templates/Community/Frame.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ withDefaults(defineProps<{
2828
:style="{ backgroundImage: `url(${image})` }"
2929
/>
3030
<div class="flex flex-col items-center text-center">
31-
<h1 class="flex gap-4 text-7xl font-bold">
31+
<h1 class="flex gap-4 text-7xl font-bold" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
3232
<Icon
3333
v-if="icon"
3434
:name="icon"
3535
/>
3636
{{ title }}
3737
</h1>
38-
<p class="text-2xl max-w-3xl">
38+
<p class="text-2xl max-w-3xl" style="display: block; line-clamp: 3; text-overflow: ellipsis;">
3939
{{ description }}
4040
</p>
4141
</div>

src/runtime/app/components/Templates/Community/Nuxt.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ const description = computed(() => (props.description || '').slice(0, 200))
4949
<p v-if="headline" class="uppercase text-[24px] text-[#00DC82] mb-4 font-semibold">
5050
{{ headline }}
5151
</p>
52-
<h1 v-if="title" class="w-[600px] m-0 text-[75px] font-semibold mb-4 text-white flex items-center">
53-
<span>{{ title }}</span>
52+
<h1 v-if="title" class="w-[600px] m-0 text-[75px] font-semibold mb-4 text-white" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
53+
{{ title }}
5454
</h1>
55-
<p v-if="description" class="text-[32px] text-[#E4E4E7] leading-tight">
55+
<p v-if="description" class="text-[32px] text-[#E4E4E7] leading-tight" style="display: block; line-clamp: 3; text-overflow: ellipsis;">
5656
{{ description }}
5757
</p>
5858
</div>

src/runtime/app/components/Templates/Community/NuxtSeo.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,16 @@ if (typeof props.icon === 'string' && !runtimeConfig.hasNuxtIcon && process.dev)
106106
<div class="h-full w-full justify-between relative">
107107
<div class="flex flex-row justify-between items-start">
108108
<div class="flex flex-col w-full max-w-[65%]">
109-
<h1 class="m-0 font-bold mb-[30px] text-[75px]">
109+
<h1 class="m-0 font-bold mb-[30px] text-[75px]" style="display: block; text-overflow: ellipsis;" :style="{ lineClamp: description ? 2 : 3 }">
110110
{{ title }}
111111
</h1>
112112
<p
113-
v-if="description" class="text-[35px]" :class="[
113+
v-if="description"
114+
class="text-[35px] leading-12"
115+
:class="[
114116
colorMode === 'light' ? ['text-gray-700'] : ['text-gray-300'],
115117
]"
118+
style="display: block; line-clamp: 3; text-overflow: ellipsis;"
116119
>
117120
{{ description }}
118121
</p>

src/runtime/app/components/Templates/Community/Pergel.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ const title = computed(() => props.title.slice(0, 60))
3434
<p v-if="headline" class="uppercase text-[24px] text-[#FEC476] mb-4 font-semibold">
3535
{{ headline }}
3636
</p>
37-
<h1 class="w-[600px] m-0 text-[75px] font-semibold mb-4 text-white flex items-center">
38-
<span>{{ title }}</span>
37+
<h1 class="w-[600px] m-0 text-[75px] font-semibold mb-4 text-white" style="display: block; line-clamp: 2; text-overflow: ellipsis;">
38+
{{ title }}
3939
</h1>
40-
<p class="text-[32px] text-[#E4E4E7] leading-tight">
41-
{{ description.slice(0, 200) }}
40+
<p class="text-[32px] text-[#E4E4E7] leading-tight" style="display: block; line-clamp: 3; text-overflow: ellipsis;">
41+
{{ description }}
4242
</p>
4343
</div>
4444

0 commit comments

Comments
 (0)