Files
Assclaw f852e7c941
Magent CI/CD / verify (push) Failing after 9m34s
Magent CI/CD / deploy-beta (push) Skipped
chore: standardize security and quality foundations
2026-09-17 20:03:47 +12:00

64 lines
1.7 KiB
TypeScript

"use client";
import { useEffect, useRef, type ReactNode } from "react";
export default function IssueFlowStep({
number,
title,
summary,
active,
complete,
onEdit,
children,
}: {
number: number;
title: string;
summary: string;
active: boolean;
complete: boolean;
onEdit: () => void;
children: ReactNode;
}) {
const heading = useRef<HTMLHeadingElement>(null);
useEffect(() => {
if (!active || number === 1) return;
heading.current?.focus({ preventScroll: true });
heading.current?.scrollIntoView({ block: "nearest", behavior: "instant" });
}, [active, number]);
if (!active && !complete) return null;
return (
<section className={`issue-procedure-step ${active ? "is-current" : "is-complete"}`} aria-label={title}>
{active ? (
<>
<div className="issue-flow-heading">
<span className="issue-step-number" aria-hidden="true">
{String(number).padStart(2, "0")}
</span>
<h2 ref={heading} tabIndex={-1}>
{title}
</h2>
</div>
<div className="issue-procedure-content">{children}</div>
</>
) : (
<button
type="button"
className="issue-step-summary"
onClick={onEdit}
aria-label={`Change ${title}: ${summary}`}
>
<span className="issue-step-number" aria-hidden="true">
</span>
<span className="issue-step-summary-copy">
<small>{title}</small>
<strong>{summary}</strong>
</span>
<span className="issue-step-change">Change</span>
</button>
)}
</section>
);
}