Show Login and Ask an organizer sent and error states.

Connect the live modals to the drawn sent, expired, invalid-email, and send-failed screens, pin the phone footer above the keyboard, and send the light login email.
This commit is contained in:
adilallo committed 2026-11-11 16:55:09 -07:00
1 parent 44010c7b73
commit 27d74e510c
29 files changed
+771 -281

No files matched your search

@@ -5,6 +5,7 @@
*/
import { memo, useRef } from "react";
import { useVisualViewportHeight } from "../../../hooks";
import { CreateView } from "./Create.view";
import type { CreateProps } from "./Create.types";
import { useCreateModalA11y } from "./useCreateModalA11y";
@@ -43,9 +44,13 @@ const CreateContainer = memo<CreateProps>(
kebabMenuAriaLabel,
kebabMenuItems,
belowCard,
presentation = "dialog",
}) => {
const createRef = useRef<HTMLDivElement>(null);
const overlayRef = useRef<HTMLDivElement>(null);
const viewportHeight = useVisualViewportHeight(
isOpen && presentation === "sheet",
);
useCreateModalA11y(isOpen, onClose, createRef);
@@ -86,6 +91,8 @@ const CreateContainer = memo<CreateProps>(
kebabMenuAriaLabel={kebabMenuAriaLabel}
kebabMenuItems={kebabMenuItems}
belowCard={belowCard}
presentation={presentation}
viewportHeight={viewportHeight}
/>
);
},
+8 -1
View File
@@ -1,5 +1,8 @@
import type { RefObject } from "react";
import type { CreateModalBackdropVariant } from "./CreateModalFrame.view";
import type {
CreateModalBackdropVariant,
CreateModalPresentationValue,
} from "./CreateModalFrame.view";
import type { ModalHeaderMenuItem } from "../ModalHeader/ModalHeader.types";
export interface CreateProps {
@@ -51,6 +54,8 @@ export interface CreateProps {
kebabMenuItems?: ModalHeaderMenuItem[];
/** Rendered below the dialog card on the backdrop (e.g. “Back to home”). */
belowCard?: React.ReactNode;
/** `sheet` is the phone full-viewport layout used by Ask an organizer. */
presentation?: CreateModalPresentationValue;
}
export interface CreateViewProps {
@@ -88,4 +93,6 @@ export interface CreateViewProps {
kebabMenuAriaLabel?: string;
kebabMenuItems?: ModalHeaderMenuItem[];
belowCard?: React.ReactNode;
presentation: CreateModalPresentationValue;
viewportHeight?: number;
}
@@ -41,6 +41,8 @@ export function CreateView({
kebabMenuAriaLabel,
kebabMenuItems,
belowCard,
presentation,
viewportHeight,
}: CreateViewProps) {
return (
<CreateModalFrameView
@@ -53,6 +55,8 @@ export function CreateView({
overlayRef={overlayRef}
dialogRef={createRef}
belowCard={belowCard}
presentation={presentation}
viewportHeight={viewportHeight}
>
<ModalHeader
onClose={onClose}
@@ -31,6 +31,8 @@ export type CreateModalFrameViewProps = {
* from `md`. `dialog` is the centered card used by Create and Dialog.
*/
presentation?: CreateModalPresentationValue;
/** Visible viewport height so a phone sheet footer rides above the keyboard. */
viewportHeight?: number;
};
/**
@@ -48,6 +50,7 @@ export function CreateModalFrameView({
children,
belowCard,
presentation = "dialog",
viewportHeight,
}: CreateModalFrameViewProps) {
if (!isOpen) return null;
@@ -55,14 +58,21 @@ export function CreateModalFrameView({
const overlayLayout = isSheet
? "flex flex-col items-stretch justify-end overflow-hidden p-0 md:items-center md:justify-center md:gap-6 md:overflow-y-auto md:px-4 md:py-8"
: "flex flex-col items-center justify-center gap-6 overflow-y-auto px-4 py-8";
const sheetHeight =
viewportHeight != null ? "h-full max-h-full" : "h-dvh max-h-dvh";
const dialogShell = isSheet
? "flex h-dvh max-h-dvh min-h-0 w-full shrink-0 flex-col overflow-hidden rounded-none bg-[var(--color-surface-default-primary)] shadow-[0px_0px_48px_0px_rgba(0,0,0,0.1)] z-[9999] md:h-auto md:max-h-[90vh] md:w-[546px] md:max-w-[546px] md:rounded-[var(--radius-500)]"
? `flex ${sheetHeight} min-h-0 w-full shrink-0 flex-col overflow-hidden rounded-none bg-[var(--color-surface-default-primary)] shadow-[0px_0px_48px_0px_rgba(0,0,0,0.1)] z-[9999] md:h-auto md:max-h-[90vh] md:w-[546px] md:max-w-[546px] md:rounded-[var(--radius-500)]`
: "flex min-h-0 max-h-[90vh] w-full max-w-[560px] shrink-0 flex-col overflow-hidden rounded-[var(--radius-500)] bg-[var(--color-surface-default-primary)] shadow-[0px_0px_48px_0px_rgba(0,0,0,0.1)] z-[9999]";
const overlayStyle =
isSheet && viewportHeight != null
? { height: viewportHeight, maxHeight: viewportHeight }
: undefined;
const content = (
<div
ref={overlayRef}
className={`${backdropOverlayClasses[backdropVariant]} ${overlayLayout}`}
style={overlayStyle}
onClick={onOverlayClick}
role="presentation"
>
@@ -78,7 +88,10 @@ export function CreateModalFrameView({
{children}
</div>
{belowCard ? (
<div className="shrink-0" onClick={(e) => e.stopPropagation()}>
<div
className={`shrink-0 ${isSheet ? "hidden md:block" : ""}`}
onClick={(e) => e.stopPropagation()}
>
{belowCard}
</div>
) : null}
@@ -6,6 +6,20 @@ import { useEffect, useLayoutEffect, useRef } from "react";
const FOCUSABLE_SELECTOR =
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])';
const FIELD_SELECTOR =
'input:not([type="hidden"]):not([type="checkbox"]):not([disabled]):not([tabindex="-1"]), textarea:not([disabled]):not([tabindex="-1"])';
function initialFocus(dialog: HTMLElement): HTMLElement | undefined {
const email = dialog.querySelector<HTMLElement>(
'input[type="email"]:not([disabled]):not([tabindex="-1"])',
);
if (email) return email;
const field = dialog.querySelector<HTMLElement>(FIELD_SELECTOR);
if (field) return field;
const focusable = dialog.querySelectorAll(FOCUSABLE_SELECTOR);
return focusable[0] as HTMLElement | undefined;
}
let lastInteractedFocusable: HTMLElement | null = null;
let interactionTrackingBound = false;
@@ -118,10 +132,7 @@ export function useCreateModalA11y(
document.body.style.overflow = "hidden";
if (dialogRef.current) {
const focusableElements = dialogRef.current.querySelectorAll(
FOCUSABLE_SELECTOR,
);
const firstElement = focusableElements[0] as HTMLElement | undefined;
const firstElement = initialFocus(dialogRef.current);
if (firstElement) {
firstElement.focus();
} else {