Skip to content

Commit 806e120

Browse files
Adebesin-Cellclaude
andcommitted
feat: add OG image for compare pages
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5aff68f commit 806e120

File tree

4 files changed

+97
-0
lines changed

4 files changed

+97
-0
lines changed

.github/assets/og-compare-2pkg.png

35.6 KB
Loading

.github/assets/og-compare-4pkg.png

47.4 KB
Loading

app/components/OgImage/Compare.vue

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<script setup lang="ts">
2+
import { computed } from 'vue'
3+
4+
const props = withDefaults(
5+
defineProps<{
6+
packages: string | string[]
7+
primaryColor?: string
8+
}>(),
9+
{
10+
packages: () => [],
11+
primaryColor: '#60a5fa',
12+
},
13+
)
14+
15+
const ACCENT_COLORS = ['#60a5fa', '#f472b6', '#34d399', '#fbbf24']
16+
17+
const displayPackages = computed(() => {
18+
const raw = props.packages
19+
const list = typeof raw === 'string'
20+
? raw.split(',').map(p => p.trim()).filter(Boolean)
21+
: raw
22+
return list.slice(0, 4)
23+
})
24+
</script>
25+
26+
<template>
27+
<div
28+
class="h-full w-full flex flex-col justify-center px-20 bg-[#050505] text-[#fafafa] relative overflow-hidden"
29+
style="font-family: 'Geist Mono', sans-serif"
30+
>
31+
<div class="relative z-10 flex flex-col gap-6">
32+
<!-- Icon + title row (same pattern as Default/Package) -->
33+
<div class="flex items-start gap-4">
34+
<div
35+
class="flex items-center justify-center w-16 h-16 p-3.5 rounded-xl shadow-lg bg-gradient-to-tr from-[#3b82f6]"
36+
:style="{ backgroundColor: primaryColor }"
37+
>
38+
<svg
39+
width="36"
40+
height="36"
41+
viewBox="0 0 24 24"
42+
fill="none"
43+
stroke="white"
44+
stroke-width="2.5"
45+
stroke-linecap="round"
46+
stroke-linejoin="round"
47+
>
48+
<circle cx="18" cy="18" r="3" />
49+
<circle cx="6" cy="6" r="3" />
50+
<path d="M13 6h3a2 2 0 0 1 2 2v7" />
51+
<path d="M11 18H8a2 2 0 0 1-2-2V9" />
52+
</svg>
53+
</div>
54+
55+
<h1 class="text-8xl font-bold">
56+
<span
57+
class="opacity-80 tracking-[-0.1em]"
58+
:style="{ color: primaryColor }"
59+
style="margin-left: -1rem; margin-right: 0.5rem"
60+
>./</span>compare
61+
</h1>
62+
</div>
63+
64+
<!-- Package names as badges (same badge style as Default/Package) -->
65+
<div
66+
class="flex flex-wrap items-center gap-x-3 gap-y-3 text-4xl text-[#a3a3a3]"
67+
style="font-family: 'Geist', sans-serif"
68+
>
69+
<template v-for="(pkg, index) in displayPackages" :key="pkg">
70+
<span
71+
class="px-3 py-1 rounded-lg border font-normal"
72+
:style="{
73+
color: ACCENT_COLORS[index % ACCENT_COLORS.length],
74+
backgroundColor: ACCENT_COLORS[index % ACCENT_COLORS.length] + '10',
75+
borderColor: ACCENT_COLORS[index % ACCENT_COLORS.length] + '30',
76+
boxShadow: `0 0 20px ${ACCENT_COLORS[index % ACCENT_COLORS.length]}25`,
77+
}"
78+
>
79+
{{ pkg }}
80+
</span>
81+
<span v-if="index < displayPackages.length - 1">
82+
vs
83+
</span>
84+
</template>
85+
</div>
86+
</div>
87+
88+
<div
89+
class="absolute -top-32 -inset-ie-32 w-[550px] h-[550px] rounded-full blur-3xl"
90+
:style="{ backgroundColor: primaryColor + '10' }"
91+
/>
92+
</div>
93+
</template>

app/pages/compare.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ function exportComparisonDataAsMarkdown() {
135135
copy(markdown)
136136
}
137137
138+
defineOgImageComponent('Compare', {
139+
packages: () => packages.value,
140+
})
141+
138142
useSeoMeta({
139143
title: () =>
140144
packages.value.length > 0

0 commit comments

Comments
 (0)