Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions app/components/LandingLogo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<script setup lang="ts">
defineProps<{
class?: string
}>()

const { env } = useAppConfig().buildInfo

onPrehydrate(el => {
const isKawaii = new URLSearchParams(window.location.search).has('kawaii')
const date = new Intl.DateTimeFormat('en-US', {
timeZone: 'America/Los_Angeles',
month: '2-digit',
day: '2-digit',
}).format(new Date())
const isAprilFirst = date === '04/01'

if (!isKawaii && !isAprilFirst) return

const normalLogo = el.querySelector<HTMLElement>('#npmx-index-h1-logo-normal')
const kawaiiLogo = el.querySelector<HTMLElement>('#npmx-index-h1-logo-kawaii')
const tkawaiiLogo = el.querySelector<HTMLElement>('#npmx-index-h1-logo-tkawaii')
const logoEnv = el.querySelector<HTMLElement>('#npmx-index-h1-logo-env')
const logoTagline = el.querySelector<HTMLElement>('#npmx-index-tagline')

if (!normalLogo || !kawaiiLogo || !tkawaiiLogo || !logoEnv || !logoTagline) return

if (isAprilFirst) {
tkawaiiLogo.style.display = 'block'
} else {
kawaiiLogo.style.display = 'block'
}
normalLogo.style.display = 'none'
logoEnv.style.display = 'none'
logoTagline.style.display = 'none'
})
</script>

<template>
<div class="flex flex-col items-center justify-center">
<h1
dir="ltr"
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"
>
<img
id="npmx-index-h1-logo-kawaii"
width="400"
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"
src="/extra/npmx-cute.svg"
:alt="$t('alt_logo_kawaii')"
:class="class"
/>
<img
id="npmx-index-h1-logo-tkawaii"
width="400"
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"
src="/extra/npmx-cute-transgender.svg"
:alt="$t('alt_logo_kawaii')"
:class="class"
/>
<AppLogo id="npmx-index-h1-logo-normal" :class="class" />
<span
id="npmx-index-h1-logo-env"
aria-hidden="true"
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"
>
{{ env === 'release' ? 'alpha' : env }}
</span>
</h1>
<p
id="npmx-index-tagline"
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"
>
{{ $t('tagline') }}
</p>
</div>
</template>
22 changes: 1 addition & 21 deletions app/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ async function search() {
startSearch()
}

const { env } = useAppConfig().buildInfo

useSeoMeta({
title: () => $t('seo.home.title'),
ogTitle: () => $t('seo.home.title'),
Expand All @@ -32,25 +30,7 @@ defineOgImageComponent('Default', {
<header
class="flex-1 flex flex-col items-center justify-center text-center pt-20 pb-4 md:pb-8 lg:pb-20"
>
<h1
dir="ltr"
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"
>
<AppLogo class="w-42 h-auto sm:w-58 md:w-70" />
<span
aria-hidden="true"
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"
>
{{ env === 'release' ? 'alpha' : env }}
</span>
</h1>

<p
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"
style="animation-delay: 0.1s"
>
{{ $t('tagline') }}
</p>
<LandingLogo class="w-42 h-auto sm:w-58 md:w-70" />
<search
class="w-full max-w-2xl motion-safe:animate-slide-up motion-safe:animate-fill-both"
style="animation-delay: 0.2s"
Expand Down
3 changes: 2 additions & 1 deletion i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1521,5 +1521,6 @@
"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}.",
"discord_link_text": "chat.npmx.dev"
}
}
},
"alt_logo_kawaii": "A cute, rounded, and colorful version of the npmx logo."
}
3 changes: 3 additions & 0 deletions i18n/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4570,6 +4570,9 @@
},
"additionalProperties": false
},
"alt_logo_kawaii": {
"type": "string"
},
"$schema": {
"type": "string"
}
Expand Down
122 changes: 122 additions & 0 deletions public/extra/npmx-cute-transgender.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions public/extra/npmx-cute.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions test/nuxt/a11y.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ import {
BlueskyPostEmbed,
BuildEnvironment,
ButtonBase,
LandingLogo,
LinkBase,
CallToAction,
ChartPatternSlot,
Expand Down Expand Up @@ -331,6 +332,14 @@ describe('component accessibility audits', () => {
})
})

describe('LandingLogo', () => {
it('should have no accessibility violations', async () => {
const component = await mountSuspended(LandingLogo)
const results = await runAxe(component)
expect(results.violations).toEqual([])
})
})

describe('AppFooter', () => {
it('should have no accessibility violations', async () => {
const component = await mountSuspended(AppFooter)
Expand Down
Loading