Skip to content

Commit 5edff1c

Browse files
committed
Adds geist mono font references for the opengraph renderer
1 parent 0051355 commit 5edff1c

File tree

10 files changed

+37
-18
lines changed

10 files changed

+37
-18
lines changed

app/components/OgImage/Package.vue

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script setup lang="ts">
2+
import { computed } from 'vue'
3+
24
interface Props {
35
name: string
46
version: string
@@ -94,12 +96,23 @@ const truncatedVersion = computed(() => {
9496

9597
<h1
9698
class="font-bold tracking-tight leading-none mt-0"
97-
:style="{ fontSize: `${titleFontSize}px`, marginBottom: '-8px' }"
99+
:style="{
100+
fontSize: `${titleFontSize}px`,
101+
marginBottom: '-8px',
102+
fontFamily: 'Geist Mono, monospace',
103+
}"
98104
>
99105
<span class="opacity-80" :style="{ color: props.primaryColor }">./</span>{{ props.name }}
100106
</h1>
101107

102-
<span class="pb-1" :style="{ fontSize: `${versionFontSize}px`, color: props.primaryColor }">
108+
<span
109+
class="pb-1"
110+
:style="{
111+
fontSize: `${versionFontSize}px`,
112+
color: props.primaryColor,
113+
fontFamily: 'Geist Mono, monospace',
114+
}"
115+
>
103116
v{{ truncatedVersion }}
104117
</span>
105118
</div>
@@ -133,7 +146,7 @@ const truncatedVersion = computed(() => {
133146

134147
<h1
135148
class="font-bold tracking-tight leading-none"
136-
:style="{ fontSize: `${titleFontSize}px` }"
149+
:style="{ fontSize: `${titleFontSize}px`, fontFamily: 'Geist Mono, monospace' }"
137150
>
138151
{{ props.name }}
139152
</h1>
@@ -147,11 +160,18 @@ const truncatedVersion = computed(() => {
147160
fontSize: `${versionFontSize}px`,
148161
color: props.primaryColor,
149162
paddingLeft: '22px',
163+
fontFamily: 'Geist Mono, monospace',
150164
}"
151165
>
152166
./
153167
</div>
154-
<span :style="{ fontSize: `${versionFontSize}px`, color: props.primaryColor }">
168+
<span
169+
:style="{
170+
fontSize: `${versionFontSize}px`,
171+
color: props.primaryColor,
172+
fontFamily: 'Geist Mono, monospace',
173+
}"
174+
>
155175
v{{ truncatedVersion }}
156176
</span>
157177
</div>
@@ -198,7 +218,10 @@ const truncatedVersion = computed(() => {
198218
v-if="props.repoOwner && props.repoName"
199219
class="flex flex-row items-center gap-12 text-3xl text-[#737373]"
200220
>
201-
<span class="flex flex-row items-center gap-3">
221+
<span
222+
class="flex flex-row items-center gap-3"
223+
:style="{ fontFamily: 'Geist Mono, monospace' }"
224+
>
202225
<svg width="28" height="28" viewBox="0 0 24 24" fill="currentColor">
203226
<path
204227
d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"

app/pages/[...package].vue

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,6 @@ function formatOgDate(isoDate?: string): string {
271271
return date.toLocaleDateString('en-US', { month: 'short', day: 'numeric', year: 'numeric' })
272272
}
273273
274-
function formatCompactNumber(num: number): string {
275-
if (num >= 1_000_000_000) {
276-
return `${(num / 1_000_000_000).toFixed(num >= 10_000_000_000 ? 0 : 1).replace(/\.0$/, '')}B`
277-
}
278-
if (num >= 1_000_000) {
279-
return `${(num / 1_000_000).toFixed(num >= 10_000_000 ? 0 : 1).replace(/\.0$/, '')}M`
280-
}
281-
if (num >= 1_000) {
282-
return `${(num / 1_000).toFixed(num >= 10_000 ? 0 : 1).replace(/\.0$/, '')}K`
283-
}
284-
return num.toString()
285-
}
286-
287274
// Computed values for OG image
288275
const ogRepoRef = computed(() => {
289276
const repoUrl = displayVersion.value?.repository?.url

nuxt.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ export default defineNuxtConfig({
178178
defaults: {
179179
component: 'Default',
180180
},
181+
fonts: [
182+
{ name: 'Geist', weight: 400, path: '/fonts/Geist-Regular.ttf' },
183+
{ name: 'Geist', weight: 500, path: '/fonts/Geist-Medium.ttf' },
184+
{ name: 'Geist', weight: 600, path: '/fonts/Geist-SemiBold.ttf' },
185+
{ name: 'Geist', weight: 700, path: '/fonts/Geist-Bold.ttf' },
186+
{ name: 'Geist Mono', weight: 400, path: '/fonts/GeistMono-Regular.ttf' },
187+
{ name: 'Geist Mono', weight: 500, path: '/fonts/GeistMono-Medium.ttf' },
188+
{ name: 'Geist Mono', weight: 700, path: '/fonts/GeistMono-Bold.ttf' },
189+
],
181190
},
182191

183192
pwa: {

public/fonts/Geist-Bold.ttf

70.1 KB
Binary file not shown.

public/fonts/Geist-Medium.ttf

70.4 KB
Binary file not shown.

public/fonts/Geist-Regular.ttf

69.4 KB
Binary file not shown.

public/fonts/Geist-SemiBold.ttf

70.4 KB
Binary file not shown.

public/fonts/GeistMono-Bold.ttf

68.2 KB
Binary file not shown.

public/fonts/GeistMono-Medium.ttf

68.4 KB
Binary file not shown.

public/fonts/GeistMono-Regular.ttf

68.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)