diff --git a/docs/design-system.md b/docs/design-system.md index b3efb32..b051087 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -100,11 +100,11 @@ Fonts are loaded via Google Fonts in `src/layouts/BaseLayout.astro` with `precon Three variants, all pill-shaped: -| Variant | Look | Usage | -| ----------- | ---------------------------- | ---------------------------------- | -| `primary` | Pink background, white text | Main CTAs ("Join", "Donate") | -| `secondary` | Yellow background, dark text | Secondary actions | -| `outline` | Transparent with border | Tertiary actions, dark backgrounds | +| Variant | Look | Usage | +| ----------- | -------------------------------- | ---------------------------------- | +| `primary` | Pink background, brand-dark text | Main CTAs ("Join", "Donate") | +| `secondary` | Yellow background, dark text | Secondary actions | +| `outline` | Transparent with border | Tertiary actions, dark backgrounds | ```astro @@ -146,6 +146,8 @@ Ratios measured in the Book, not estimated here. White on yellow is the one that looks acceptable on a bright laptop and is unreadable everywhere else. The homepage hero is yellow, so it uses **dark** text — that is the reason, not a stylistic preference. +Primary pink (`accent-400` / brand pink) CTAs use **brand-dark** text, not white — white-on-pink fails AA for normal text (about 2.7:1). Ink-on-pink clears AA (5.4:1 in the table above). Header RSVP already follows this; the shared `Button` primary variant matches. + ### Focus states The Book specifies: **pink ring (`#FF66A8`), 2px outline, 2px offset — identical across buttons, inputs and links.** Never blue. Never hover-only for navigation. The default browser focus ring is blue, which is out of system, so it gets replaced rather than suppressed. diff --git a/e2e/contrast.spec.ts b/e2e/contrast.spec.ts index df8446a..10df71a 100644 --- a/e2e/contrast.spec.ts +++ b/e2e/contrast.spec.ts @@ -11,9 +11,9 @@ import { test, expect, type Locator } from '@playwright/test'; * that changes tokens, swaps a component, or introduces a hover state that inverts * the pairing gets caught, not just a literal `text-white` reappearing. * - * Scope is deliberately the elements this branch redesigned. The same pairing still - * exists on the shared Button component and on several page-level CTA sections that - * predate this work — tracked separately rather than silently restyled here. + * Header / event-bar RSVP and the shared `Button` primary variant (pink on + * brand-dark) are both gated here. `/about` has no primary Button — the + * regression target is `/support` `data-testid="primary-cta"`. */ const AA_NORMAL_TEXT = 4.5; @@ -112,4 +112,19 @@ test.describe('primary CTA colour contrast', () => { `current nav label is ${ratio.toFixed(2)}:1 (${color} on ${pill}), needs ${AA_NORMAL_TEXT}:1`, ).toBeGreaterThanOrEqual(AA_NORMAL_TEXT); }); + + test('the shared primary Button meets WCAG AA for normal text', async ({ page }) => { + await page.setViewportSize({ width: 1440, height: 900 }); + await page.goto('/support'); + + const cta = page.getByTestId('primary-cta'); + await expect(cta).toBeVisible(); + + const { color, background } = await effectiveColours(cta); + const ratio = contrastRatio(color, background); + expect( + ratio, + `primary Button is ${ratio.toFixed(2)}:1 (${color} on ${background}), needs ${AA_NORMAL_TEXT}:1`, + ).toBeGreaterThanOrEqual(AA_NORMAL_TEXT); + }); }); diff --git a/src/components/Button.astro b/src/components/Button.astro index af400df..a45c532 100644 --- a/src/components/Button.astro +++ b/src/components/Button.astro @@ -22,7 +22,7 @@ const baseClasses = const variantClasses = { primary: - 'bg-accent-400 text-white hover:bg-accent-500 focus:ring-accent-400 shadow-md hover:shadow-lg hover:-translate-y-0.5', + 'bg-accent-400 text-brand-dark hover:bg-accent-500 focus:ring-accent-400 shadow-md hover:shadow-lg hover:-translate-y-0.5', secondary: 'bg-primary-300 text-brand-dark hover:bg-primary-400 focus:ring-primary-400 shadow-md hover:shadow-lg hover:-translate-y-0.5', outline: diff --git a/src/pages/_blog/index.astro b/src/pages/_blog/index.astro index fe263a7..129001f 100644 --- a/src/pages/_blog/index.astro +++ b/src/pages/_blog/index.astro @@ -87,7 +87,7 @@ const posts = (await getCollection('blog')).sort( -
+

Share your voice

@@ -107,7 +107,6 @@ const posts = (await getCollection('blog')).sort( href="/contact" variant="outline" size="lg" - class="!text-white !border-white hover:!bg-white/10" > Get in Touch diff --git a/src/pages/about.astro b/src/pages/about.astro index 6de7333..6aeca65 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -155,7 +155,7 @@ const programs = [

-
+

Come build with us

Show up before you feel ready.

@@ -165,7 +165,6 @@ const programs = [ href="/events" variant="outline" size="lg" - class="!text-white !border-white hover:!bg-white/10" > Attend an event diff --git a/src/pages/contact.astro b/src/pages/contact.astro index 087c97d..11ac9aa 100644 --- a/src/pages/contact.astro +++ b/src/pages/contact.astro @@ -248,7 +248,7 @@ import { site, links } from '../config'; diff --git a/src/pages/events.astro b/src/pages/events.astro index 44ceb70..27a16b6 100644 --- a/src/pages/events.astro +++ b/src/pages/events.astro @@ -194,7 +194,7 @@ const photos = (await getCollection('gallery')).sort(
-
+

Ready to join us?

@@ -208,7 +208,6 @@ const photos = (await getCollection('gallery')).sort( href="/join" variant="outline" size="lg" - class="!text-white !border-white hover:!bg-white/10" > Join the Community diff --git a/src/pages/join.astro b/src/pages/join.astro index ac74e85..225a3ee 100644 --- a/src/pages/join.astro +++ b/src/pages/join.astro @@ -46,7 +46,7 @@ const secondaryRoutes = [ title="Join PhilaCon Valley - Get involved" description="Show up before you feel ready. Open your first pull request, come to a Lab, or get on Discord." > -

+

Join the community

diff --git a/src/pages/projects/index.astro b/src/pages/projects/index.astro index ebc1584..0b8675d 100644 --- a/src/pages/projects/index.astro +++ b/src/pages/projects/index.astro @@ -201,7 +201,7 @@ const displayNames: Record = {
-
+

Built something cool?

@@ -215,7 +215,6 @@ const displayNames: Record = { external variant="outline" size="lg" - class="!text-white !border-white hover:!bg-white/10" > View on GitHub diff --git a/src/pages/resources/index.astro b/src/pages/resources/index.astro index d993a70..cd46752 100644 --- a/src/pages/resources/index.astro +++ b/src/pages/resources/index.astro @@ -198,7 +198,7 @@ const levels = [...new Set(resources.map((r) => r.data.level))]; } -

+

Share your knowledge

@@ -211,7 +211,6 @@ const levels = [...new Set(resources.map((r) => r.data.level))]; href="/join" variant="outline" size="lg" - class="!text-white !border-white hover:!bg-white/10" > Join the Community diff --git a/src/pages/support.astro b/src/pages/support.astro index 1c83b24..5b57e62 100644 --- a/src/pages/support.astro +++ b/src/pages/support.astro @@ -155,7 +155,13 @@ import { links } from '../config'; Visit our Open Collective page to make a one-time or recurring contribution. All transactions are transparent and publicly visible.

-
@@ -217,7 +223,7 @@ import { links } from '../config';
-
+

Ready to make an impact?

@@ -231,7 +237,6 @@ import { links } from '../config'; href="/contact" variant="outline" size="lg" - class="!text-white !border-white hover:!bg-white/10" > Other ways to help