Skip to content

Commit b0d97ff

Browse files
alfonsusaccoderabbitai[bot]autofix-ci[bot]alexdln
authored
feat: add kawai logo in npmx.dev homepage (#2346)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Vordgi <sasha2822222@gmail.com>
1 parent 2e0fb05 commit b0d97ff

File tree

7 files changed

+318
-22
lines changed

7 files changed

+318
-22
lines changed

app/components/LandingLogo.vue

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<script setup lang="ts">
2+
defineProps<{
3+
class?: string
4+
}>()
5+
6+
const { env } = useAppConfig().buildInfo
7+
8+
onPrehydrate(el => {
9+
const isKawaii = new URLSearchParams(window.location.search).has('kawaii')
10+
const date = new Intl.DateTimeFormat('en-US', {
11+
timeZone: 'America/Los_Angeles',
12+
month: '2-digit',
13+
day: '2-digit',
14+
}).format(new Date())
15+
const isAprilFirst = date === '04/01'
16+
17+
if (!isKawaii && !isAprilFirst) return
18+
19+
const normalLogo = el.querySelector<HTMLElement>('#npmx-index-h1-logo-normal')
20+
const kawaiiLogo = el.querySelector<HTMLElement>('#npmx-index-h1-logo-kawaii')
21+
const tkawaiiLogo = el.querySelector<HTMLElement>('#npmx-index-h1-logo-tkawaii')
22+
const logoEnv = el.querySelector<HTMLElement>('#npmx-index-h1-logo-env')
23+
const logoTagline = el.querySelector<HTMLElement>('#npmx-index-tagline')
24+
25+
if (!normalLogo || !kawaiiLogo || !tkawaiiLogo || !logoEnv || !logoTagline) return
26+
27+
if (isAprilFirst) {
28+
tkawaiiLogo.style.display = 'block'
29+
} else {
30+
kawaiiLogo.style.display = 'block'
31+
}
32+
normalLogo.style.display = 'none'
33+
logoEnv.style.display = 'none'
34+
logoTagline.style.display = 'none'
35+
})
36+
</script>
37+
38+
<template>
39+
<div class="flex flex-col items-center justify-center">
40+
<h1
41+
dir="ltr"
42+
class="relative flex items-center justify-center gap-2 header-logo font-mono text-5xl sm:text-7xl md:text-8xl font-medium tracking-tight mb-6 motion-safe:animate-fade-in motion-safe:animate-fill-both"
43+
>
44+
<img
45+
id="npmx-index-h1-logo-kawaii"
46+
width="400"
47+
class="hidden mb-8 motion-safe:animate-fade-in motion-safe:animate-scale-in motion-safe:hover:scale-105 motion-safe:transition w-80 sm:w-100"
48+
src="/extra/npmx-cute.svg"
49+
:alt="$t('alt_logo_kawaii')"
50+
:class="class"
51+
/>
52+
<img
53+
id="npmx-index-h1-logo-tkawaii"
54+
width="400"
55+
class="hidden mb-8 motion-safe:animate-fade-in motion-safe:animate-scale-in motion-safe:hover:scale-105 motion-safe:transition w-80 sm:w-100"
56+
src="/extra/npmx-cute-transgender.svg"
57+
:alt="$t('alt_logo_kawaii')"
58+
:class="class"
59+
/>
60+
<AppLogo id="npmx-index-h1-logo-normal" :class="class" />
61+
<span
62+
id="npmx-index-h1-logo-env"
63+
aria-hidden="true"
64+
class="text-sm sm:text-base md:text-lg transform-origin-br font-mono tracking-widest text-accent absolute -bottom-4 -inset-ie-1.5"
65+
>
66+
{{ env === 'release' ? 'alpha' : env }}
67+
</span>
68+
</h1>
69+
<p
70+
id="npmx-index-tagline"
71+
class="text-fg-muted text-lg sm:text-xl max-w-xl mb-12 lg:mb-14 motion-safe:animate-slide-up motion-safe:animate-fill-both delay-100"
72+
>
73+
{{ $t('tagline') }}
74+
</p>
75+
</div>
76+
</template>

app/pages/index.vue

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ async function search() {
88
startSearch()
99
}
1010
11-
const { env } = useAppConfig().buildInfo
12-
1311
useSeoMeta({
1412
title: () => $t('seo.home.title'),
1513
ogTitle: () => $t('seo.home.title'),
@@ -32,25 +30,7 @@ defineOgImageComponent('Default', {
3230
<header
3331
class="flex-1 flex flex-col items-center justify-center text-center pt-20 pb-4 md:pb-8 lg:pb-20"
3432
>
35-
<h1
36-
dir="ltr"
37-
class="relative flex items-center justify-center gap-2 header-logo font-mono text-5xl sm:text-7xl md:text-8xl font-medium tracking-tight mb-6 motion-safe:animate-fade-in motion-safe:animate-fill-both"
38-
>
39-
<AppLogo class="w-42 h-auto sm:w-58 md:w-70" />
40-
<span
41-
aria-hidden="true"
42-
class="text-sm sm:text-base md:text-lg transform-origin-br font-mono tracking-widest text-accent absolute -bottom-4 -inset-ie-1.5"
43-
>
44-
{{ env === 'release' ? 'alpha' : env }}
45-
</span>
46-
</h1>
47-
48-
<p
49-
class="text-fg-muted text-lg sm:text-xl max-w-xl mb-12 lg:mb-14 motion-safe:animate-slide-up motion-safe:animate-fill-both"
50-
style="animation-delay: 0.1s"
51-
>
52-
{{ $t('tagline') }}
53-
</p>
33+
<LandingLogo class="w-42 h-auto sm:w-58 md:w-70" />
5434
<search
5535
class="w-full max-w-2xl motion-safe:animate-slide-up motion-safe:animate-fill-both"
5636
style="animation-delay: 0.2s"

i18n/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,5 +1521,6 @@
15211521
"message": "Accessibility matters to us, and we would love you to follow us in this vision. When using mentioned media, ensure there is enough contrast against the background, and don't go smaller than 24px. If you need any other resources or additional information about the project, feel free to reach us at {link}.",
15221522
"discord_link_text": "chat.npmx.dev"
15231523
}
1524-
}
1524+
},
1525+
"alt_logo_kawaii": "A cute, rounded, and colorful version of the npmx logo."
15251526
}

i18n/schema.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4570,6 +4570,9 @@
45704570
},
45714571
"additionalProperties": false
45724572
},
4573+
"alt_logo_kawaii": {
4574+
"type": "string"
4575+
},
45734576
"$schema": {
45744577
"type": "string"
45754578
}

public/extra/npmx-cute-transgender.svg

Lines changed: 122 additions & 0 deletions
Loading

public/extra/npmx-cute.svg

Lines changed: 105 additions & 0 deletions
Loading

test/nuxt/a11y.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ import {
141141
BlueskyPostEmbed,
142142
BuildEnvironment,
143143
ButtonBase,
144+
LandingLogo,
144145
LinkBase,
145146
CallToAction,
146147
ChartPatternSlot,
@@ -331,6 +332,14 @@ describe('component accessibility audits', () => {
331332
})
332333
})
333334

335+
describe('LandingLogo', () => {
336+
it('should have no accessibility violations', async () => {
337+
const component = await mountSuspended(LandingLogo)
338+
const results = await runAxe(component)
339+
expect(results.violations).toEqual([])
340+
})
341+
})
342+
334343
describe('AppFooter', () => {
335344
it('should have no accessibility violations', async () => {
336345
const component = await mountSuspended(AppFooter)

0 commit comments

Comments
 (0)