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.`}

- )} -
-
+ {session.status === 'signedOut' ? ( + + ) : ( +

+ {t`Loading…`} +

+ )} +
+
+
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( + +

Welcome

+
+ ); + const heading = screen.getByRole('heading', { name: 'Welcome' }); + expect(heading.closest('[data-sleeve]')).not.toBeNull(); + }); + + it('draws its slot and glare as decoration only', () => { + const { container } = render( + +

Badge

+
+ ); + const sleeve = container.querySelector('[data-sleeve]'); + const decoration = [...(sleeve?.children ?? [])].filter( + (child) => child.tagName === 'SPAN' + ); + expect(decoration).toHaveLength(2); + for (const part of decoration) { + expect(part).toHaveAttribute('aria-hidden', 'true'); + expect(part).toBeEmptyDOMElement(); + } + }); + + it('takes layout classes, and a ref for what turns it', () => { + const ref = createRef(); + const { container } = render( + +

Badge

+
+ ); + const sleeve = container.querySelector('[data-sleeve]'); + expect(ref.current).toBe(sleeve); + // Its own padding gives way to the caller's. + expect(sleeve?.className).toMatch(/(^|\s)p-4(\s|$)/); + expect(sleeve?.className).not.toMatch(/(^|\s)p-2\.5(\s|$)/); + const [slot, glare] = [...(sleeve?.querySelectorAll('span') ?? [])]; + expect(slot?.className).toMatch(/(^|\s)top-4(\s|$)/); + expect(glare?.className).toMatch(/(^|\s)hidden(\s|$)/); + }); +}); diff --git a/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.tsx b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.tsx new file mode 100644 index 0000000..3c89cc8 --- /dev/null +++ b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.tsx @@ -0,0 +1,25 @@ +import { cn } from '@/lib/utils'; + +import * as styles from './BadgeSleeve.styles'; +import type { BadgeSleeveProps } from './BadgeSleeve.types'; + +/** + * The clear sleeve a badge hangs in (#169), on the Share screen, the + * homepage and the sign-in page (#170). Its lip's slot is where a + * LanyardRibbon's clasp goes through. + */ +export function BadgeSleeve({ + children, + ref, + className, + slotClassName, + glareClassName, +}: BadgeSleeveProps) { + return ( +
+
+ ); +} diff --git a/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.types.ts b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.types.ts new file mode 100644 index 0000000..230185a --- /dev/null +++ b/web/src/features/qr/components/BadgeSleeve/BadgeSleeve.types.ts @@ -0,0 +1,13 @@ +import type { ReactNode, Ref } from 'react'; + +export type BadgeSleeveProps = { + /** The badge it holds. */ + children: ReactNode; + /** The sleeve: the element that turns, if it sways. */ + ref?: Ref; + className?: string; + /** The lip's slot, where the clasp goes through. */ + slotClassName?: string; + /** The light on the plastic. */ + glareClassName?: string; +}; diff --git a/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.constants.ts b/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.constants.ts index d26d6b1..24d21a5 100644 --- a/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.constants.ts +++ b/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.constants.ts @@ -19,3 +19,6 @@ export const SEPARATOR = ' · '; /** The clasp's metal, light along its middle. */ export const METAL = ['#8d8ba3', '#f1f1f7', '#77758c'] as const; + +/** What Lanyards' own lanyards print, where there's no person's handle. */ +export const BRAND_PRINT = 'lanyards.app'; diff --git a/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.styles.ts b/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.styles.ts index 9894cd5..6a284fc 100644 --- a/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.styles.ts +++ b/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.styles.ts @@ -1,6 +1,7 @@ // The straps in the owner's strap colour, printed in the badge's label // colour, which reads on it (spec §8); the clasp is metal on any accent. -export const ribbon = 'overflow-visible'; +// Decoration: anything it hangs over still takes the click. +export const ribbon = 'pointer-events-none overflow-visible'; export const strap = 'fill-none stroke-qr-strap'; diff --git a/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.types.ts b/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.types.ts index 69d53cd..3f71188 100644 --- a/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.types.ts +++ b/web/src/features/qr/components/LanyardRibbon/LanyardRibbon.types.ts @@ -1,5 +1,8 @@ export type LanyardRibbonProps = { - /** Printed along both straps, repeated: the person's handle (#169). */ + /** + * Printed along both straps, repeated: the person's handle (#169), or + * Lanyards' own address (#170). + */ text: string; className?: string; }; diff --git a/web/src/features/qr/components/LanyardStraps/LanyardStraps.constants.ts b/web/src/features/qr/components/LanyardStraps/LanyardStraps.constants.ts deleted file mode 100644 index 9addde7..0000000 --- a/web/src/features/qr/components/LanyardStraps/LanyardStraps.constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -/** The drawing's box: two straps meeting at the clip, bottom centre. */ -export const VIEW = { width: 160, height: 96 }; - -/** Each strap, as polygon points, from the top edge down to the clip. */ -export const STRAPS = ['18,0 50,0 96,96 64,96', '110,0 142,0 96,96 64,96']; diff --git a/web/src/features/qr/components/LanyardStraps/LanyardStraps.styles.ts b/web/src/features/qr/components/LanyardStraps/LanyardStraps.styles.ts deleted file mode 100644 index 108f78a..0000000 --- a/web/src/features/qr/components/LanyardStraps/LanyardStraps.styles.ts +++ /dev/null @@ -1 +0,0 @@ -export const straps = 'block h-24 w-40 shrink-0 fill-qr-strap'; diff --git a/web/src/features/qr/components/LanyardStraps/LanyardStraps.tsx b/web/src/features/qr/components/LanyardStraps/LanyardStraps.tsx deleted file mode 100644 index 8f801bc..0000000 --- a/web/src/features/qr/components/LanyardStraps/LanyardStraps.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { cn } from '@/lib/utils'; - -import { STRAPS, VIEW } from './LanyardStraps.constants'; -import * as styles from './LanyardStraps.styles'; -import type { LanyardStrapsProps } from './LanyardStraps.types'; - -/** Two lanyard straps meeting above the Share badge (spec §8). */ -export function LanyardStraps({ className }: LanyardStrapsProps) { - return ( - - ); -} diff --git a/web/src/features/qr/components/LanyardStraps/LanyardStraps.types.ts b/web/src/features/qr/components/LanyardStraps/LanyardStraps.types.ts deleted file mode 100644 index ffdf192..0000000 --- a/web/src/features/qr/components/LanyardStraps/LanyardStraps.types.ts +++ /dev/null @@ -1 +0,0 @@ -export type LanyardStrapsProps = { className?: string }; diff --git a/web/src/features/qr/components/QrSheet/QrSheet.styles.ts b/web/src/features/qr/components/QrSheet/QrSheet.styles.ts index 9aa00c8..a4e3b68 100644 --- a/web/src/features/qr/components/QrSheet/QrSheet.styles.ts +++ b/web/src/features/qr/components/QrSheet/QrSheet.styles.ts @@ -41,17 +41,13 @@ export const hang = export const ribbon = 'relative z-10 h-28 w-auto shrink-0 translate-y-[1.125rem] [@media(max-height:44rem)]:hidden wide:h-44 flat:hidden'; -// Clear plastic, with a lip where the clasp goes through. -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)] max-[22.5rem]:p-1.5 max-[22.5rem]:pt-7 flat:contents'; +// The sleeve (BadgeSleeve), a little tighter on the narrowest phones; +// sideways the screen is the badge, so there's no sleeve. +export const sleeve = 'max-[22.5rem]:p-1.5 max-[22.5rem]:pt-7 flat:contents'; -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 max-[22.5rem]:top-2 flat:hidden'; +export const slot = 'max-[22.5rem]:top-2 flat:hidden'; -// Light on the plastic, over the badge but under the code, so the code -// always scans. -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%)] flat:hidden'; +export const glare = 'flat:hidden'; export const card = 'relative flex w-full flex-col overflow-hidden rounded-sm bg-accent text-on-accent flat:contents'; @@ -128,8 +124,8 @@ export const copy = `${action} border-white text-white hover:bg-white/10 flat:bo export const icon = 'size-[1.125rem] shrink-0 max-[22.5rem]:hidden'; // With the actions on phones; in the corner where there's room, and -// sideways. +// sideways, drawn over the lanyard where a strap runs past (#170). export const close = - 'flex size-14 shrink-0 items-center justify-center rounded-sm text-white hover:bg-white/10 focus-visible:outline-white wide:absolute wide:right-5 wide:top-5 flat:absolute flat:right-3 flat:top-3 flat:text-on-accent flat:hover:bg-on-accent/10 flat:focus-visible:outline-(--focus-ring-on-accent)'; + 'relative z-30 flex size-14 shrink-0 items-center justify-center rounded-sm text-white hover:bg-white/10 focus-visible:outline-white wide:absolute wide:right-5 wide:top-5 flat:absolute flat:right-3 flat:top-3 flat:text-on-accent flat:hover:bg-on-accent/10 flat:focus-visible:outline-(--focus-ring-on-accent)'; export const closeIcon = 'size-6'; diff --git a/web/src/features/qr/components/QrSheet/QrSheet.tsx b/web/src/features/qr/components/QrSheet/QrSheet.tsx index 32eedcc..bc07ec4 100644 --- a/web/src/features/qr/components/QrSheet/QrSheet.tsx +++ b/web/src/features/qr/components/QrSheet/QrSheet.tsx @@ -13,6 +13,7 @@ import { heroName } from '@/lib/person/hero'; import { qrUrl } from '../../qrUrl'; import { useOwnerBadge } from '../../useOwnerBadge'; +import { BadgeSleeve } from '../BadgeSleeve/BadgeSleeve'; import { LanyardRibbon } from '../LanyardRibbon/LanyardRibbon'; import { NAME_LENGTHS } from './QrSheet.constants'; import * as styles from './QrSheet.styles'; @@ -120,9 +121,11 @@ export function QrSheet({ className={styles.ribbon} /> )} -
-
{canShare() && ( diff --git a/web/src/i18n/locales/en-GB/messages.po b/web/src/i18n/locales/en-GB/messages.po index 2c23bae..c0c8fd2 100644 --- a/web/src/i18n/locales/en-GB/messages.po +++ b/web/src/i18n/locales/en-GB/messages.po @@ -42,7 +42,7 @@ msgstr "{name} is over position {position} of {total}." msgid "{name} moved to position {position} of {total}" msgstr "{name} moved to position {position} of {total}" -#: src/features/qr/components/QrSheet/QrSheet.tsx:69 +#: src/features/qr/components/QrSheet/QrSheet.tsx:70 msgid "{name} on Lanyards" msgstr "{name} on Lanyards" @@ -159,7 +159,7 @@ msgid "Badge" msgstr "Badge" #: src/features/lanyard/components/DepartureBoard/DepartureBoard.tsx:84 -#: src/features/qr/components/QrSheet/QrSheet.tsx:157 +#: src/features/qr/components/QrSheet/QrSheet.tsx:160 msgid "Based" msgstr "Based" @@ -266,7 +266,7 @@ msgstr "Clear" #: src/components/Dialog/Dialog.tsx:75 #: src/components/Sheet/Sheet.tsx:59 -#: src/features/qr/components/QrSheet/QrSheet.tsx:188 +#: src/features/qr/components/QrSheet/QrSheet.tsx:191 msgid "Close" msgstr "Close" @@ -315,7 +315,7 @@ msgid "Contract roles" msgstr "Contract roles" #: src/features/lanyard/customise/OrcidHelper/OrcidHelper.tsx:149 -#: src/features/qr/components/QrSheet/QrSheet.tsx:186 +#: src/features/qr/components/QrSheet/QrSheet.tsx:189 msgid "Copy link" msgstr "Copy link" @@ -340,7 +340,7 @@ msgid "Couldn't copy it. Please try again." msgstr "Couldn't copy it. Please try again." #: src/features/lanyard/customise/OrcidHelper/OrcidHelper.tsx:94 -#: src/features/qr/components/QrSheet/QrSheet.tsx:63 +#: src/features/qr/components/QrSheet/QrSheet.tsx:64 msgid "Couldn't copy the link. Please try again." msgstr "Couldn't copy the link. Please try again." @@ -357,7 +357,7 @@ msgstr "Couldn't load your lanyard settings" msgid "Couldn't open feedback. Please try again." msgstr "Couldn't open feedback. Please try again." -#: src/features/qr/components/QrSheet/QrSheet.tsx:74 +#: src/features/qr/components/QrSheet/QrSheet.tsx:75 msgid "Couldn't open sharing. Copy the link instead." msgstr "Couldn't open sharing. Copy the link instead." @@ -708,7 +708,7 @@ msgid "Lime" msgstr "Lime" #: src/features/lanyard/customise/OrcidHelper/OrcidHelper.tsx:91 -#: src/features/qr/components/QrSheet/QrSheet.tsx:60 +#: src/features/qr/components/QrSheet/QrSheet.tsx:61 msgid "Link copied" msgstr "Link copied" @@ -730,7 +730,7 @@ msgstr "Loading your profile…" #: src/features/account/components/SettingsPage/SettingsPage.tsx:28 #: src/features/feedback/components/FeedbackDialog/FeedbackDialog.tsx:246 -#: src/features/home/components/SignInPage/SignInPage.tsx:65 +#: src/features/home/components/SignInPage/SignInPage.tsx:68 #: src/features/lanyard/customise/CustomisePage/CustomisePage.tsx:68 #: src/features/qr/components/SharePage/SharePage.tsx:41 msgid "Loading…" @@ -800,7 +800,7 @@ msgstr "Nothing to show yet" #: src/features/lanyard/components/blocks/RolesBlock/RolesBlock.tsx:59 #: src/features/lanyard/components/DepartureBoard/DepartureBoard.tsx:67 -#: src/features/qr/components/QrSheet/QrSheet.tsx:151 +#: src/features/qr/components/QrSheet/QrSheet.tsx:154 msgid "Now" msgstr "Now" @@ -895,7 +895,7 @@ msgstr "Podcast episode" msgid "Podcasts and videos" msgstr "Podcasts and videos" -#: src/features/qr/components/QrSheet/QrSheet.tsx:113 +#: src/features/qr/components/QrSheet/QrSheet.tsx:114 msgid "Point a camera at the code to open my lanyard, or send the link." msgstr "Point a camera at the code to open my lanyard, or send the link." @@ -1005,7 +1005,7 @@ msgstr "Save or reset your lanyard changes first: giving permission leaves this msgid "Saving…" msgstr "Saving…" -#: src/features/qr/components/QrSheet/QrSheet.tsx:138 +#: src/features/qr/components/QrSheet/QrSheet.tsx:141 msgid "Scan to see my lanyard" msgstr "Scan to see my lanyard" @@ -1043,8 +1043,8 @@ msgid "Send more" msgstr "Send more" #: src/components/MobileNav/MobileNav.tsx:71 -#: src/features/qr/components/QrSheet/QrSheet.tsx:110 -#: src/features/qr/components/QrSheet/QrSheet.tsx:175 +#: src/features/qr/components/QrSheet/QrSheet.tsx:111 +#: src/features/qr/components/QrSheet/QrSheet.tsx:178 #: src/features/qr/components/ShareLink/ShareLink.tsx:26 msgid "Share" msgstr "Share" @@ -1086,8 +1086,8 @@ msgstr "Sifa" #: src/features/auth/components/CallbackStatus/CallbackStatus.tsx:32 #: src/features/auth/components/SignInForm/SignInForm.tsx:109 #: src/features/home/components/HomeHeader/HomeHeader.tsx:35 -#: src/features/home/components/SignInPage/SignInPage.tsx:29 -#: src/features/home/components/SignInPage/SignInPage.tsx:56 +#: src/features/home/components/SignInPage/SignInPage.tsx:32 +#: src/features/home/components/SignInPage/SignInPage.tsx:59 #: src/features/lanyard/components/LanyardPage/LanyardPage.tsx:98 msgid "Sign in" msgstr "Sign in" @@ -1208,7 +1208,7 @@ msgstr "Thank you" msgid "That doesn't look like a handle — for example alice.bsky.social" msgstr "That doesn't look like a handle — for example alice.bsky.social" -#: src/features/home/components/HomeBadge/HomeBadge.tsx:41 +#: src/features/home/components/HomeBadge/HomeBadge.tsx:49 msgid "The curated link for academic researchers that collects your complete scholarly presence—publications, talks, affiliations, and social profiles." msgstr "The curated link for academic researchers that collects your complete scholarly presence—publications, talks, affiliations, and social profiles." @@ -1314,7 +1314,7 @@ msgstr "Update once, share everywhere. No more Sunday afternoons updating ten di msgid "Updating your podcasts and videos…" msgstr "Updating your podcasts and videos…" -#: src/features/home/components/SignInPage/SignInPage.tsx:59 +#: src/features/home/components/SignInPage/SignInPage.tsx:62 msgid "Use your handle from Bluesky or any other AT Protocol app. New here? Create an account, and it’s yours to take anywhere." msgstr "Use your handle from Bluesky or any other AT Protocol app. New here? Create an account, and it’s yours to take anywhere." @@ -1393,7 +1393,7 @@ msgstr "We couldn't read your lanyard settings" msgid "Web address" msgstr "Web address" -#: src/features/home/components/HomeBadge/HomeBadge.tsx:38 +#: src/features/home/components/HomeBadge/HomeBadge.tsx:46 msgid "Welcome to Lanyards" msgstr "Welcome to Lanyards" @@ -1474,7 +1474,7 @@ msgid "Your handle" msgstr "Your handle" #: src/features/lanyard/customise/CustomisePage/CustomisePage.tsx:51 -#: src/features/qr/components/QrSheet/QrSheet.tsx:50 +#: src/features/qr/components/QrSheet/QrSheet.tsx:51 msgid "Your lanyard" msgstr "Your lanyard"