Page updates: v1.10.3 to v1.10.6 #20
7 changed files with 243 additions and 2 deletions
|
|
@ -9,7 +9,8 @@
|
||||||
<meta name="theme-color" content="#073d4a" media="(prefers-color-scheme: light)" />
|
<meta name="theme-color" content="#073d4a" media="(prefers-color-scheme: light)" />
|
||||||
<meta name="theme-color" content="#0c1d21" media="(prefers-color-scheme: dark)" />
|
<meta name="theme-color" content="#0c1d21" media="(prefers-color-scheme: dark)" />
|
||||||
<!-- Theme before first paint, so a dark visitor never sees a white
|
<!-- Theme before first paint, so a dark visitor never sees a white
|
||||||
flash: this browser's choice (ThemeToggle), else the system. -->
|
flash: this browser's choice (ThemeToggle), else the system;
|
||||||
|
and the accessibility choices, for the same reason. -->
|
||||||
<script>
|
<script>
|
||||||
try {
|
try {
|
||||||
// Once: browser keys used to start "ngu-"; move them to "site-"
|
// Once: browser keys used to start "ngu-"; move them to "site-"
|
||||||
|
|
@ -25,6 +26,9 @@
|
||||||
var t = localStorage.getItem("site-theme");
|
var t = localStorage.getItem("site-theme");
|
||||||
document.documentElement.dataset.theme =
|
document.documentElement.dataset.theme =
|
||||||
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
t === "dark" || t === "light" ? t : matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
||||||
|
// The accessibility panel's choices (AccessibilityPanel.tsx).
|
||||||
|
if (localStorage.getItem("site-font") === "dyslexic") document.documentElement.dataset.font = "dyslexic";
|
||||||
|
if (localStorage.getItem("site-reading") === "on") document.documentElement.dataset.reading = "on";
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
</script>
|
</script>
|
||||||
<!-- site:head-end -->
|
<!-- site:head-end -->
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/montserrat": "^5.3.0",
|
"@fontsource/montserrat": "^5.3.0",
|
||||||
|
"@fontsource/opendyslexic": "^5.3.0",
|
||||||
"@fontsource/poppins": "^5.3.0",
|
"@fontsource/poppins": "^5.3.0",
|
||||||
"@phosphor-icons/react": "^2.1.10",
|
"@phosphor-icons/react": "^2.1.10",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
|
|
|
||||||
8
pnpm-lock.yaml
generated
8
pnpm-lock.yaml
generated
|
|
@ -11,6 +11,9 @@ importers:
|
||||||
'@fontsource/montserrat':
|
'@fontsource/montserrat':
|
||||||
specifier: ^5.3.0
|
specifier: ^5.3.0
|
||||||
version: 5.3.0
|
version: 5.3.0
|
||||||
|
'@fontsource/opendyslexic':
|
||||||
|
specifier: ^5.3.0
|
||||||
|
version: 5.3.0
|
||||||
'@fontsource/poppins':
|
'@fontsource/poppins':
|
||||||
specifier: ^5.3.0
|
specifier: ^5.3.0
|
||||||
version: 5.3.0
|
version: 5.3.0
|
||||||
|
|
@ -66,6 +69,9 @@ packages:
|
||||||
'@fontsource/montserrat@5.3.0':
|
'@fontsource/montserrat@5.3.0':
|
||||||
resolution: {integrity: sha512-iQPDtZOnmM5ih4JBGaMSXisRap0ixb9bAUw2hDtY7EjVfaqiiNlKtVuJl9XclxUwtwMMHNcWXfQR6zI9x05+Tg==}
|
resolution: {integrity: sha512-iQPDtZOnmM5ih4JBGaMSXisRap0ixb9bAUw2hDtY7EjVfaqiiNlKtVuJl9XclxUwtwMMHNcWXfQR6zI9x05+Tg==}
|
||||||
|
|
||||||
|
'@fontsource/opendyslexic@5.3.0':
|
||||||
|
resolution: {integrity: sha512-BVYIW/ghc1U2iAghhYTN+GFWiZ3lnCy8Jf2KkZC23aHQHBNcMqKT718zckfqVxRx4qsXJmIMPWvczirRuhmtsg==}
|
||||||
|
|
||||||
'@fontsource/poppins@5.3.0':
|
'@fontsource/poppins@5.3.0':
|
||||||
resolution: {integrity: sha512-cms1nM7U6SN8epIV1WMVOV8VsA645aSm3wHfzIQnkk188U341ThbJGSl2Sv54V29gnDbT2arMPfLzvVIIVCceQ==}
|
resolution: {integrity: sha512-cms1nM7U6SN8epIV1WMVOV8VsA645aSm3wHfzIQnkk188U341ThbJGSl2Sv54V29gnDbT2arMPfLzvVIIVCceQ==}
|
||||||
|
|
||||||
|
|
@ -786,6 +792,8 @@ snapshots:
|
||||||
|
|
||||||
'@fontsource/montserrat@5.3.0': {}
|
'@fontsource/montserrat@5.3.0': {}
|
||||||
|
|
||||||
|
'@fontsource/opendyslexic@5.3.0': {}
|
||||||
|
|
||||||
'@fontsource/poppins@5.3.0': {}
|
'@fontsource/poppins@5.3.0': {}
|
||||||
|
|
||||||
'@jridgewell/gen-mapping@0.3.13':
|
'@jridgewell/gen-mapping@0.3.13':
|
||||||
|
|
|
||||||
168
src/components/AccessibilityPanel.tsx
Normal file
168
src/components/AccessibilityPanel.tsx
Normal file
|
|
@ -0,0 +1,168 @@
|
||||||
|
/* ═══════════════════════════════════════════════════════════════
|
||||||
|
ACCESSIBILITY PANEL
|
||||||
|
|
||||||
|
A button fixed to the bottom right of every public page, opening
|
||||||
|
two switches that change how the whole site reads:
|
||||||
|
|
||||||
|
Dyslexia-friendly font every typeface becomes OpenDyslexic
|
||||||
|
(self-hosted, index.css)
|
||||||
|
Reading mode the design steps back: no background
|
||||||
|
circles, motion or shadows, one column,
|
||||||
|
larger text and plain underlined links,
|
||||||
|
the same content throughout
|
||||||
|
|
||||||
|
Each is a data attribute on <html> (data-font, data-reading) that
|
||||||
|
index.css styles, saved in this browser (site-font, site-reading)
|
||||||
|
and set again before the first paint by index.html, so a page
|
||||||
|
never flashes the other look. Blocked storage just means the
|
||||||
|
choice lasts until the tab closes.
|
||||||
|
|
||||||
|
The panel closes on Escape, on the button again, or a click
|
||||||
|
anywhere else, and gives focus back to the button.
|
||||||
|
═══════════════════════════════════════════════════════════════ */
|
||||||
|
|
||||||
|
import { PersonArmsSpread, X } from '@phosphor-icons/react'
|
||||||
|
import { useEffect, useId, useRef, useState } from 'react'
|
||||||
|
|
||||||
|
/* A setting: its <html> attribute, storage key, the value that turns
|
||||||
|
it on, and its words. */
|
||||||
|
const SETTINGS = [
|
||||||
|
{
|
||||||
|
attribute: 'font',
|
||||||
|
key: 'site-font',
|
||||||
|
on: 'dyslexic',
|
||||||
|
label: 'Dyslexia-friendly font',
|
||||||
|
help: 'Letters shaped to be easier to tell apart.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
attribute: 'reading',
|
||||||
|
key: 'site-reading',
|
||||||
|
on: 'on',
|
||||||
|
label: 'Reading mode',
|
||||||
|
help: 'A plain, single column with larger text and no motion.',
|
||||||
|
},
|
||||||
|
] as const
|
||||||
|
|
||||||
|
type Setting = (typeof SETTINGS)[number]
|
||||||
|
|
||||||
|
const isOn = (setting: Setting) => document.documentElement.dataset[setting.attribute] === setting.on
|
||||||
|
|
||||||
|
function apply(setting: Setting, on: boolean) {
|
||||||
|
const root = document.documentElement
|
||||||
|
if (on) root.dataset[setting.attribute] = setting.on
|
||||||
|
else delete root.dataset[setting.attribute]
|
||||||
|
try {
|
||||||
|
if (on) localStorage.setItem(setting.key, setting.on)
|
||||||
|
else localStorage.removeItem(setting.key)
|
||||||
|
} catch {
|
||||||
|
// Storage blocked: the choice holds for this page view.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function AccessibilityPanel() {
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
const [state, setState] = useState(() => Object.fromEntries(SETTINGS.map((s) => [s.key, isOn(s)])))
|
||||||
|
const rootRef = useRef<HTMLDivElement>(null)
|
||||||
|
const buttonRef = useRef<HTMLButtonElement>(null)
|
||||||
|
const panelId = useId()
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!open) return undefined
|
||||||
|
const close = () => {
|
||||||
|
setOpen(false)
|
||||||
|
buttonRef.current?.focus()
|
||||||
|
}
|
||||||
|
const onKey = (event: KeyboardEvent) => {
|
||||||
|
if (event.key === 'Escape') close()
|
||||||
|
}
|
||||||
|
const onPointer = (event: PointerEvent) => {
|
||||||
|
if (!rootRef.current?.contains(event.target as Node)) setOpen(false)
|
||||||
|
}
|
||||||
|
document.addEventListener('keydown', onKey)
|
||||||
|
document.addEventListener('pointerdown', onPointer)
|
||||||
|
return () => {
|
||||||
|
document.removeEventListener('keydown', onKey)
|
||||||
|
document.removeEventListener('pointerdown', onPointer)
|
||||||
|
}
|
||||||
|
}, [open])
|
||||||
|
|
||||||
|
const toggle = (setting: Setting) => {
|
||||||
|
const next = !state[setting.key]
|
||||||
|
apply(setting, next)
|
||||||
|
setState((current) => ({ ...current, [setting.key]: next }))
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={rootRef} className="fixed right-4 bottom-4 z-40 print:hidden">
|
||||||
|
{open && (
|
||||||
|
<div
|
||||||
|
id={panelId}
|
||||||
|
role="region"
|
||||||
|
aria-label="Accessibility"
|
||||||
|
className="absolute right-0 bottom-full mb-3 w-[min(20rem,calc(100vw-2rem))] border border-brand/20 bg-raised p-4 shadow-xl"
|
||||||
|
>
|
||||||
|
<div className="flex items-center justify-between gap-4">
|
||||||
|
<h2 className="font-display text-base font-bold text-ink">Accessibility</h2>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => {
|
||||||
|
setOpen(false)
|
||||||
|
buttonRef.current?.focus()
|
||||||
|
}}
|
||||||
|
className="btn flex h-8 w-8 items-center justify-center text-muted hover:bg-tint"
|
||||||
|
aria-label="Close accessibility options"
|
||||||
|
>
|
||||||
|
<X size={18} weight="bold" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul className="mt-3 space-y-3">
|
||||||
|
{SETTINGS.map((setting) => {
|
||||||
|
const on = state[setting.key]
|
||||||
|
const labelId = `${panelId}-${setting.attribute}`
|
||||||
|
return (
|
||||||
|
<li key={setting.key} className="flex items-start gap-3">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
role="switch"
|
||||||
|
aria-checked={on}
|
||||||
|
aria-labelledby={labelId}
|
||||||
|
onClick={() => toggle(setting)}
|
||||||
|
className={`relative mt-0.5 h-6 w-11 shrink-0 rounded-full border-2 transition-colors ${
|
||||||
|
on ? 'border-action bg-action' : 'border-muted/50 bg-surface'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
aria-hidden="true"
|
||||||
|
className={`absolute top-0.5 h-4 w-4 rounded-full transition-transform ${
|
||||||
|
on ? 'translate-x-5 bg-white' : 'translate-x-0.5 bg-muted'
|
||||||
|
}`}
|
||||||
|
/>
|
||||||
|
</button>
|
||||||
|
<span>
|
||||||
|
<span id={labelId} className="block font-semibold text-ink">
|
||||||
|
{setting.label}
|
||||||
|
</span>
|
||||||
|
<span className="block text-sm text-muted">{setting.help}</span>
|
||||||
|
</span>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<button
|
||||||
|
ref={buttonRef}
|
||||||
|
type="button"
|
||||||
|
onClick={() => setOpen((value) => !value)}
|
||||||
|
aria-expanded={open}
|
||||||
|
aria-controls={open ? panelId : undefined}
|
||||||
|
aria-label="Accessibility options"
|
||||||
|
className="btn flex h-12 w-12 items-center justify-center bg-action text-white shadow-lg transition-colors hover:bg-action-hover"
|
||||||
|
>
|
||||||
|
<PersonArmsSpread size={26} weight="bold" aria-hidden="true" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,7 @@ import siteLogo from "../assets/logos/NGU_Logo.svg";
|
||||||
import Footer from "./Footer.tsx";
|
import Footer from "./Footer.tsx";
|
||||||
import PrivacyNotice from "./PrivacyNotice.tsx";
|
import PrivacyNotice from "./PrivacyNotice.tsx";
|
||||||
import PageBackdrop from "./PageBackdrop.tsx";
|
import PageBackdrop from "./PageBackdrop.tsx";
|
||||||
|
import AccessibilityPanel from "./AccessibilityPanel.tsx";
|
||||||
import ThemeToggle from "./ThemeToggle.tsx";
|
import ThemeToggle from "./ThemeToggle.tsx";
|
||||||
import { scrollBehavior } from "../lib/motion.ts";
|
import { scrollBehavior } from "../lib/motion.ts";
|
||||||
|
|
||||||
|
|
@ -289,6 +290,7 @@ export default function Layout() {
|
||||||
<div inert={mobileMenuOpen} className="print:hidden">
|
<div inert={mobileMenuOpen} className="print:hidden">
|
||||||
<Footer />
|
<Footer />
|
||||||
<PrivacyNotice />
|
<PrivacyNotice />
|
||||||
|
<AccessibilityPanel />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Mobile menu */}
|
{/* Mobile menu */}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export default function PrivacyNotice() {
|
||||||
<div
|
<div
|
||||||
role="region"
|
role="region"
|
||||||
aria-label="Privacy notice"
|
aria-label="Privacy notice"
|
||||||
className="fixed bottom-4 left-4 right-4 z-40 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
className="fixed bottom-20 left-4 right-4 z-40 sm:bottom-4 mx-auto max-w-md border border-brand/20 bg-surface p-4 text-sm text-body shadow-xl sm:right-auto"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
|
No tracking cookies here. Videos and maps come from YouTube, Facebook or Google only when you press
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@
|
||||||
@import '@fontsource/poppins/600.css';
|
@import '@fontsource/poppins/600.css';
|
||||||
@import '@fontsource/poppins/700.css';
|
@import '@fontsource/poppins/700.css';
|
||||||
@import '@fontsource/poppins/800.css'; /* the front page's stat numbers only */
|
@import '@fontsource/poppins/800.css'; /* the front page's stat numbers only */
|
||||||
|
@import '@fontsource/opendyslexic/400.css'; /* the accessibility panel's font, */
|
||||||
|
@import '@fontsource/opendyslexic/700.css'; /* only downloaded when chosen */
|
||||||
|
|
||||||
@import 'tailwindcss';
|
@import 'tailwindcss';
|
||||||
|
|
||||||
|
|
@ -209,6 +211,62 @@ iframe[src*="churchcenter"] {
|
||||||
--btn-radius: 0.5rem;
|
--btn-radius: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Accessibility choices (AccessibilityPanel.tsx) ──────────────
|
||||||
|
Set on <html> before the first paint (index.html) and by the
|
||||||
|
panel. */
|
||||||
|
|
||||||
|
/* Dyslexia-friendly font: every typeface, headings and buttons too. */
|
||||||
|
:root[data-font="dyslexic"] {
|
||||||
|
--font-display: 'OpenDyslexic', sans-serif;
|
||||||
|
--font-body: 'OpenDyslexic', sans-serif;
|
||||||
|
}
|
||||||
|
:root[data-font="dyslexic"] body,
|
||||||
|
:root[data-font="dyslexic"] h1,
|
||||||
|
:root[data-font="dyslexic"] h2,
|
||||||
|
:root[data-font="dyslexic"] h3,
|
||||||
|
:root[data-font="dyslexic"] h4,
|
||||||
|
:root[data-font="dyslexic"] h5,
|
||||||
|
:root[data-font="dyslexic"] h6,
|
||||||
|
:root[data-font="dyslexic"] button,
|
||||||
|
:root[data-font="dyslexic"] input,
|
||||||
|
:root[data-font="dyslexic"] textarea,
|
||||||
|
:root[data-font="dyslexic"] select {
|
||||||
|
font-family: 'OpenDyslexic', sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reading mode: the same content with the design stepped back. No
|
||||||
|
background circles, motion or shadows; every layout one column,
|
||||||
|
narrower and larger, with plain underlined links. */
|
||||||
|
:root[data-reading="on"] {
|
||||||
|
font-size: 112.5%;
|
||||||
|
scroll-behavior: auto;
|
||||||
|
}
|
||||||
|
:root[data-reading="on"] .page-backdrop {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
:root[data-reading="on"] *,
|
||||||
|
:root[data-reading="on"] *::before,
|
||||||
|
:root[data-reading="on"] *::after {
|
||||||
|
animation: none !important;
|
||||||
|
transition: none !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
:root[data-reading="on"] main {
|
||||||
|
max-width: 48rem;
|
||||||
|
margin-inline: auto;
|
||||||
|
}
|
||||||
|
:root[data-reading="on"] main .grid {
|
||||||
|
grid-template-columns: minmax(0, 1fr) !important;
|
||||||
|
}
|
||||||
|
:root[data-reading="on"] main p,
|
||||||
|
:root[data-reading="on"] main li {
|
||||||
|
line-height: 1.75;
|
||||||
|
}
|
||||||
|
:root[data-reading="on"] main a {
|
||||||
|
text-decoration: underline;
|
||||||
|
text-underline-offset: 0.2em;
|
||||||
|
}
|
||||||
|
|
||||||
/* A notice where content would be (an empty section, a form's
|
/* A notice where content would be (an empty section, a form's
|
||||||
note, "coming soon"): no box and no fill, just two thick brackets
|
note, "coming soon"): no box and no fill, just two thick brackets
|
||||||
at opposite corners, top left and bottom right, like a
|
at opposite corners, top left and bottom right, like a
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue