diff --git a/web/e2e/qr.spec.ts b/web/e2e/qr.spec.ts
index 551b91d..b440f4a 100644
--- a/web/e2e/qr.spec.ts
+++ b/web/e2e/qr.spec.ts
@@ -206,6 +206,19 @@ test.describe('QR sheet', () => {
}
});
+ test('closes from its corner on a portrait tablet, over the lanyard (#170)', async ({
+ page,
+ }) => {
+ await page.setViewportSize({ width: 820, height: 1180 });
+ await page.goto('/lanyard');
+ await page.getByRole('link', { name: 'Share' }).click();
+ const sheet = page.getByRole('dialog', { name: 'Dr Ada Example' });
+ await expect(sheet).toBeVisible();
+ // A real click: it fails if the strap is over the button.
+ await sheet.getByRole('button', { name: 'Close' }).click({ timeout: 2000 });
+ await expect(sheet).toBeHidden();
+ });
+
test('stays black on white in dark mode', async ({ page }) => {
await page.emulateMedia({ colorScheme: 'dark' });
await page.goto('/lanyard');
diff --git a/web/scripts/styleRules.test.ts b/web/scripts/styleRules.test.ts
index bfd6508..b0c5a96 100644
--- a/web/scripts/styleRules.test.ts
+++ b/web/scripts/styleRules.test.ts
@@ -122,11 +122,12 @@ const CHROME = [
const LANYARD_ONLY = [
'src/components/RichText/',
'src/features/qr/components/QrSheet/',
- // Show QR as a page (#150): the badge's ground while it loads.
+ // Share as a page (#150): the badge's ground while it loads.
'src/features/qr/components/SharePage/',
- 'src/features/qr/components/LanyardStraps/',
- // The Share badge's printed lanyard (#169).
+ // The printed lanyard every badge hangs from (#169, #170).
'src/features/qr/components/LanyardRibbon/',
+ // The clear sleeve a badge hangs in (#170).
+ 'src/features/qr/components/BadgeSleeve/',
];
/**
diff --git a/web/src/features/home/components/HomeBadge/HomeBadge.styles.ts b/web/src/features/home/components/HomeBadge/HomeBadge.styles.ts
index 27e5094..c50bb58 100644
--- a/web/src/features/home/components/HomeBadge/HomeBadge.styles.ts
+++ b/web/src/features/home/components/HomeBadge/HomeBadge.styles.ts
@@ -1,26 +1,31 @@
-// Lanyards' own billboard badge (#145), hung from its straps on brand
-// blue as on the Share screen (spec §8), and built as a person's is
-// (spec §7). The badge's tokens are the same in light and dark.
+// Lanyards' own billboard badge (#145), in a clear sleeve on a lanyard
+// printed with the site's address, on brand blue, as on the Share screen
+// (#170), and built as a person's is (spec §7). The badge's tokens are the
+// same in light and dark.
-/** Edge to edge: the ground the badge hangs on. */
+/** Edge to edge: the ground the badge hangs on. Crops the straps' tops. */
export const stage =
'flex w-full flex-col items-center overflow-hidden bg-qr-ground px-4 pb-14 md:px-8 md:pb-20';
export const hang = 'flex w-full max-w-[58rem] flex-col items-center';
-export const straps = 'h-28 w-[11.75rem] md:h-40 md:w-[16.75rem]';
+// The clasp's hook ends in the sleeve's slot, a little below its top edge.
+export const ribbon =
+ 'relative z-10 h-32 w-auto shrink-0 translate-y-[1.125rem] md:h-52 md:translate-y-7';
+
+// Tilted on its clasp from md up, after one swing as it arrives. A mouse
+// sways it on the same clasp (#151), with a transform added to the tilt.
+export const sleeve =
+ 'origin-top md:-rotate-[1.5deg] md:p-4 md:pt-12 md:motion-safe:animate-swing';
+
+/** A bigger slot for the bigger sleeve. */
+export const slot = 'md:top-4 md:h-4 md:w-24';
-// Tilted on its clip from md up, after one swing as it arrives. A mouse
-// sways it on the same clip (#151), with a transform added to the tilt.
export const badge =
- '@container flex w-full origin-top flex-col overflow-hidden rounded-sm bg-accent text-on-accent shadow-[0_2px_4px_rgb(6_1_30/0.2),0_12px_24px_rgb(6_1_30/0.2),0_32px_64px_rgb(6_1_30/0.3)] md:-rotate-[1.5deg] md:motion-safe:animate-swing';
+ '@container flex w-full flex-col overflow-hidden rounded-sm bg-accent text-on-accent';
export const cover = 'relative h-30 @min-[40rem]:h-52';
-/** Where the clip goes through the badge: the ground shows through. */
-export const slot =
- 'absolute left-1/2 top-3.5 h-3 w-16 -translate-x-1/2 rounded-sm bg-qr-ground shadow-[inset_0_2px_3px_rgb(6_1_30/0.4)] @min-[40rem]:top-[1.125rem] @min-[40rem]:h-3.5 @min-[40rem]:w-24';
-
export const field =
'flex flex-col gap-4 px-5 pb-8 @min-[40rem]:px-12 @min-[40rem]:pb-12';
diff --git a/web/src/features/home/components/HomeBadge/HomeBadge.test.tsx b/web/src/features/home/components/HomeBadge/HomeBadge.test.tsx
index acfdc5d..a136362 100644
--- a/web/src/features/home/components/HomeBadge/HomeBadge.test.tsx
+++ b/web/src/features/home/components/HomeBadge/HomeBadge.test.tsx
@@ -40,6 +40,22 @@ afterEach(() => {
});
describe('HomeBadge (#151)', () => {
+ it('hangs in a clear sleeve from a lanyard printed lanyards.app (#170)', () => {
+ pointer(false);
+ const { container } = renderWithProviders(
+
+ );
+ const heading = screen.getByRole('heading', { level: 1 });
+ expect(heading.closest('[data-sleeve]')).not.toBeNull();
+ const straps = container.querySelectorAll('textPath');
+ expect(straps).toHaveLength(2);
+ for (const strap of straps) {
+ expect(strap.textContent).toContain('lanyards.app');
+ }
+ // The old plain straps are gone: one lanyard, not two.
+ expect(container.querySelectorAll('polygon')).toHaveLength(0);
+ });
+
it('sways on its clip as a mouse moves across the lanyard', () => {
pointer(true);
vi.useFakeTimers({
@@ -50,6 +66,8 @@ describe('HomeBadge (#151)', () => {
sweep(heading);
const badge = turned(heading);
expect(badge).not.toBeNull();
+ // The badge turns in its sleeve, together, on the clasp (#170).
+ expect(badge).toHaveAttribute('data-sleeve');
expect(badge?.style.transform).toMatch(/^rotate\(-[\d.]+deg\)$/);
// It turns about its clip, at the top, as the arrival swing does.
expect(badge?.className).toMatch(/(^|\s)origin-top(\s|$)/);
diff --git a/web/src/features/home/components/HomeBadge/HomeBadge.tsx b/web/src/features/home/components/HomeBadge/HomeBadge.tsx
index 96c451f..50e2dfd 100644
--- a/web/src/features/home/components/HomeBadge/HomeBadge.tsx
+++ b/web/src/features/home/components/HomeBadge/HomeBadge.tsx
@@ -3,7 +3,9 @@ import { useRef } from 'react';
import { CoverPattern } from '@/components/CoverPattern/CoverPattern';
import { Logo } from '@/components/Logo/Logo';
-import { LanyardStraps } from '@/features/qr/components/LanyardStraps/LanyardStraps';
+import { BadgeSleeve } from '@/features/qr/components/BadgeSleeve/BadgeSleeve';
+import { LanyardRibbon } from '@/features/qr/components/LanyardRibbon/LanyardRibbon';
+import { BRAND_PRINT } from '@/features/qr/components/LanyardRibbon/LanyardRibbon.constants';
import { cn } from '@/lib/utils';
import { usePointerSway } from '../../usePointerSway';
@@ -12,44 +14,51 @@ import * as styles from './HomeBadge.styles';
import type { HomeBadgeProps } from './HomeBadge.types';
/**
- * Lanyards' own billboard badge, hanging from its straps at the top of the
- * homepage (#145): the old homepage's welcome, in the new design language.
- * A mouse moving across the lanyard sways it on its clip (#151).
+ * Lanyards' own billboard badge, hanging at the top of the homepage
+ * (#145): the old homepage's welcome, in the new design language. It
+ * hangs in a clear sleeve from a lanyard printed with the site's address,
+ * as a person's does on the Share screen (#170). A mouse moving across the
+ * lanyard sways the sleeve on its clasp (#151).
*/
export function HomeBadge({ headingId, className }: HomeBadgeProps) {
const { t, i18n } = useLingui();
const lanyard = useRef(null);
- const badge = useRef(null);
- usePointerSway(lanyard, badge);
+ const sleeve = useRef(null);
+ usePointerSway(lanyard, sleeve);
return (
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
- {t`Welcome to Lanyards`}
-
-
- {t`The curated link for academic researchers that collects your complete scholarly presence—publications, talks, affiliations, and social profiles.`}
-
-
-
- {BOARD.map((cell) => (
-
-
{i18n._(cell.label)}
-
{i18n._(cell.value)}
+
+
+
- ))}
-
-
+
+ {t`Welcome to Lanyards`}
+
+
+ {t`The curated link for academic researchers that collects your complete scholarly presence—publications, talks, affiliations, and social profiles.`}
+
+
+
+ {BOARD.map((cell) => (
+
+
{i18n._(cell.label)}
+
{i18n._(cell.value)}
+
+ ))}
+
+
+
);
diff --git a/web/src/features/home/components/SignInPage/SignInPage.styles.ts b/web/src/features/home/components/SignInPage/SignInPage.styles.ts
index a255d0a..bc68537 100644
--- a/web/src/features/home/components/SignInPage/SignInPage.styles.ts
+++ b/web/src/features/home/components/SignInPage/SignInPage.styles.ts
@@ -1,27 +1,27 @@
-// The sign-in page (#157): the form on a badge, hanging on the brand blue
-// as the homepage's does, but straight and still so the form is easy to
-// use. The badge's tokens are the same in light and dark; the form keeps
-// the app's own palette in a panel on the badge.
+// The sign-in page (#157): the form on a badge in a clear sleeve, hanging
+// from a lanyard on the brand blue as the homepage's does (#170), but
+// straight and still so the form is easy to use. The badge's tokens are
+// the same in light and dark; the form keeps the app's own palette in a
+// panel on the badge.
/** The page's ground: brand blue (the blue palette's accent). */
export const page = 'relative flex min-h-dvh flex-col bg-accent';
+/** Crops the straps' tops, so they never run up behind the header. */
export const main =
- 'flex flex-1 flex-col items-center px-4 pb-14 md:px-8 md:pb-20';
+ 'flex flex-1 flex-col items-center overflow-hidden px-4 pb-14 md:px-8 md:pb-20';
export const hang = 'flex w-full max-w-[34rem] flex-col items-center';
-export const straps = 'h-24 w-[10rem] md:h-32 md:w-[12.5rem]';
+// The clasp's hook ends in the sleeve's slot, a little below its top edge.
+export const ribbon =
+ 'relative z-10 h-28 w-auto shrink-0 translate-y-[1.125rem] md:h-36';
export const badge =
- '@container flex w-full flex-col overflow-hidden rounded-sm bg-accent text-on-accent shadow-[0_2px_4px_rgb(6_1_30/0.2),0_12px_24px_rgb(6_1_30/0.2),0_32px_64px_rgb(6_1_30/0.3)]';
+ '@container flex w-full flex-col overflow-hidden rounded-sm bg-accent text-on-accent';
export const cover = 'relative h-24 @min-[30rem]:h-28';
-/** Where the clip goes through the badge: the ground shows through. */
-export const slot =
- 'absolute left-1/2 top-3 h-3 w-14 -translate-x-1/2 rounded-sm bg-qr-ground shadow-[inset_0_2px_3px_rgb(6_1_30/0.4)]';
-
export const field =
'flex flex-col gap-4 px-5 pb-6 @min-[30rem]:px-8 @min-[30rem]:pb-8';
@@ -36,9 +36,11 @@ export const heading =
export const lede = 'max-w-[34ch] text-lg font-medium leading-7';
-/** The form keeps the app's own palette: a card on the badge, full width. */
-export const form = 'max-w-none shadow-[0_1px_2px_rgb(6_1_30/0.15)]';
+// The form keeps the app's own palette: a card on the badge, full width,
+// over the sleeve's glare so its text keeps its full contrast.
+export const form =
+ 'relative z-20 max-w-none shadow-[0_1px_2px_rgb(6_1_30/0.15)]';
/** While the session loads: the same card, saying so. */
export const loading =
- 'rounded-sm border border-ui-border bg-ui-surface p-6 text-[15px] leading-[22px] text-ui-text-muted';
+ 'relative z-20 rounded-sm border border-ui-border bg-ui-surface p-6 text-[15px] leading-[22px] text-ui-text-muted';
diff --git a/web/src/features/home/components/SignInPage/SignInPage.test.tsx b/web/src/features/home/components/SignInPage/SignInPage.test.tsx
index 50d5058..b727951 100644
--- a/web/src/features/home/components/SignInPage/SignInPage.test.tsx
+++ b/web/src/features/home/components/SignInPage/SignInPage.test.tsx
@@ -52,6 +52,25 @@ describe('SignInPage (#157)', () => {
await expectNoAxeViolations(container);
});
+ it('hangs in a clear sleeve from a lanyard printed lanyards.app (#170)', async () => {
+ const { container } = page();
+ const heading = await screen.findByRole('heading', {
+ level: 1,
+ name: 'Sign in',
+ });
+ const sleeve = heading.closest('[data-sleeve]');
+ expect(sleeve).not.toBeNull();
+ expect(sleeve).toContainElement(
+ screen.getByRole('combobox', { name: 'Your handle' })
+ );
+ const straps = container.querySelectorAll('textPath');
+ expect(straps).toHaveLength(2);
+ for (const strap of straps) {
+ expect(strap.textContent).toContain('lanyards.app');
+ }
+ expect(container.querySelectorAll('polygon')).toHaveLength(0);
+ });
+
it('has the homepage’s header, without a Sign in link to itself', async () => {
page();
const banner = await screen.findByRole('banner');
diff --git a/web/src/features/home/components/SignInPage/SignInPage.tsx b/web/src/features/home/components/SignInPage/SignInPage.tsx
index 6126b1a..b811046 100644
--- a/web/src/features/home/components/SignInPage/SignInPage.tsx
+++ b/web/src/features/home/components/SignInPage/SignInPage.tsx
@@ -7,7 +7,9 @@ import { Logo } from '@/components/Logo/Logo';
import { SIGNED_IN_HOME } from '@/features/auth/components/LandingPage/LandingPage.constants';
import { SignInForm } from '@/features/auth/components/SignInForm/SignInForm';
import { useSession } from '@/features/auth/session/useSession';
-import { LanyardStraps } from '@/features/qr/components/LanyardStraps/LanyardStraps';
+import { BadgeSleeve } from '@/features/qr/components/BadgeSleeve/BadgeSleeve';
+import { LanyardRibbon } from '@/features/qr/components/LanyardRibbon/LanyardRibbon';
+import { BRAND_PRINT } from '@/features/qr/components/LanyardRibbon/LanyardRibbon.constants';
import { useDocumentTitle } from '@/hooks/useDocumentTitle';
import { safeReturnTo } from '@/lib/atproto/oauthConfig';
@@ -18,8 +20,9 @@ import type { SignInPageProps } from './SignInPage.types';
/**
* `/sign-in` (#157): the sign-in form, with its handle typeahead, on a
- * badge hanging on the brand blue. Signed in already, it sends people on
- * to where they were going.
+ * badge in a clear sleeve, hanging from a lanyard on the brand blue as the
+ * homepage's does (#170). Signed in already, it sends people on to where
+ * they were going.
*/
export function SignInPage({ returnTo }: SignInPageProps) {
const { t } = useLingui();
@@ -42,31 +45,32 @@ export function SignInPage({ returnTo }: SignInPageProps) {
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
- {t`Sign in`}
-
-
- {t`Use your handle from Bluesky or any other AT Protocol app. New here? Create an account, and it’s yours to take anywhere.`}
-
- {session.status === 'signedOut' ? (
-
- ) : (
-
- {t`Loading…`}
+
+
+
+
+
+ {t`Sign in`}
+
+
+ {t`Use your handle from Bluesky or any other AT Protocol app. New here? Create an account, and it’s yours to take anywhere.`}
diff --git a/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.styles.ts b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.styles.ts
new file mode 100644
index 0000000..50a4c69
--- /dev/null
+++ b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.styles.ts
@@ -0,0 +1,15 @@
+// A clear plastic badge sleeve (#169, #170), on any lanyard ground: the
+// plastic is white, a little opaque, and its lip has a slot where the
+// clasp goes through, so the ground shows through the slot. Callers size
+// it with their own classes, which win over these.
+
+export const sleeve =
+ 'relative isolate w-full rounded-sm border border-white/60 bg-white/15 p-2.5 pt-8 shadow-[inset_0_0_0_1px_rgb(255_255_255/0.15),0_30px_60px_rgb(6_1_30/0.3)]';
+
+export const slot =
+ 'absolute left-1/2 top-2.5 h-3 w-16 -translate-x-1/2 rounded-sm bg-qr-ground shadow-[inset_0_2px_3px_rgb(6_1_30/0.45)] ring-1 ring-white/60';
+
+// Light on the plastic, over the badge. Anything that must keep its full
+// contrast (a code to scan, a form) sits above it, at z-20.
+export const glare =
+ 'pointer-events-none absolute inset-0 z-10 rounded-sm bg-[linear-gradient(115deg,transparent_30%,rgb(255_255_255/0.22)_38%,transparent_47%,transparent_62%,rgb(255_255_255/0.12)_66%,transparent_72%)]';
diff --git a/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.test.tsx b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.test.tsx
new file mode 100644
index 0000000..dcef783
--- /dev/null
+++ b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.test.tsx
@@ -0,0 +1,56 @@
+import { render, screen } from '@testing-library/react';
+import { createRef } from 'react';
+import { describe, expect, it } from 'vitest';
+
+import { BadgeSleeve } from './BadgeSleeve';
+
+describe('BadgeSleeve (#170)', () => {
+ it('holds the badge, marked as the sleeve', () => {
+ render(
+
+