Skip to content

Commit 64036ca

Browse files
authored
feat: add telegram social preview tab (#473)
1 parent 077a907 commit 64036ca

File tree

2 files changed

+65
-1
lines changed

2 files changed

+65
-1
lines changed

packages/devtools/client/components/social/SocialPreviewGroup.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ const types = [
99
'twitter',
1010
'facebook',
1111
'linkedin',
12+
'telegram',
1213
]
1314
14-
const selected = ref(types[0])
15+
const selected = useLocalStorage('nuxt-devtools-social-preview-tab', types[0])
1516
1617
const card = computed(() => getSocialPreviewCard(props.tags, {
1718
title: [{ tag: 'title' }],
@@ -49,6 +50,9 @@ const card = computed(() => getSocialPreviewCard(props.tags, {
4950
<div v-else-if="selected === 'linkedin'">
5051
<SocialLinkedin :card="card" />
5152
</div>
53+
<div v-else-if="selected === 'telegram'">
54+
<SocialTelegram :card="card" />
55+
</div>
5256
</div>
5357
</div>
5458
</template>
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<script setup lang="ts">
2+
import type { SocialPreviewResolved } from '~/../src/types'
3+
4+
defineProps<{
5+
card: SocialPreviewResolved
6+
}>()
7+
8+
const location = useBrowserLocation()
9+
const time = useDateFormat(useNow(), 'HH:mm')
10+
</script>
11+
12+
<template>
13+
<div class="relative max-w-[420px] min-w-[420px] rounded-[16px] rounded-bl-0 py-[6px] leading-[18px] drop-shadow-sm drop-shadow-color-[#10232f26] bg-base">
14+
<div class="pl-[10px] pr-[8px]">
15+
<div class="leading-normal text-[#3390ec] underline">
16+
{{ card.url }}
17+
</div>
18+
<div class="quote w-full flex">
19+
<div class="flex flex-col gap-1">
20+
<div v-if="card.image" class="my-[3px] overflow-hidden rounded">
21+
<img class="h-full max-w-full w-full rounded object-cover" :src="card.image">
22+
</div>
23+
24+
<div class="cursor-pointer text-sm text-[#3390ec]">
25+
<strong>{{ location.hostname }}</strong>
26+
</div>
27+
28+
<div class="cursor-pointer text-sm">
29+
<strong>{{ card.title }}</strong>
30+
</div>
31+
32+
<div class="cursor-pointer text-sm">
33+
{{ card.description }}
34+
</div>
35+
</div>
36+
</div>
37+
38+
<div class="flex justify-end text-xs text-[#707579]">
39+
<span>{{ time }}</span>
40+
</div>
41+
</div>
42+
43+
<svg width="11" height="20" viewBox="0 0 11 20" xmlns="http://www.w3.org/2000/svg" class="absolute bottom-0 ml-[-8.4px] translate-y-px text-white">
44+
<g transform="translate(9 -14)" fill-rule="evenodd">
45+
<path id="corner-fill" d="M-6 16h6v17c-.193-2.84-.876-5.767-2.05-8.782-.904-2.325-2.446-4.485-4.625-6.48A1 1 0 01-6 16z" transform="matrix(1 0 0 -1 0 49)" fill="currentColor" />
46+
</g>
47+
</svg>
48+
</div>
49+
</template>
50+
51+
<style scoped>
52+
.quote::before {
53+
flex: 0 0 auto;
54+
width: 2px;
55+
border-radius: 2px;
56+
background-color: #3390ec;
57+
margin: 3px 8px 2px 0;
58+
content: "";
59+
}
60+
</style>

0 commit comments

Comments
 (0)