feat(frontend): switch to the dark graphite design system with a Lincodex wordmark
This commit is contained in:
1 parent
945ab6d6a9
commit
3c4acff803
81 files changed
+3187
-619
No files matched your search
@@ -0,0 +1,55 @@
|
||||
import { VisuallyHidden } from "../visually-hidden/visually-hidden";
|
||||
import styles from "./stepper.module.css";
|
||||
|
||||
import type { StepStatus, StepperStep } from "./build-steps";
|
||||
|
||||
const statusText: Readonly<Record<StepStatus, string>> = {
|
||||
complete: "выполнен",
|
||||
current: "текущий шаг",
|
||||
upcoming: "впереди",
|
||||
};
|
||||
|
||||
type StepperProps = {
|
||||
/** Accessible name of the step list, for example "Шаги регистрации". */
|
||||
label: string;
|
||||
steps: readonly StepperStep[];
|
||||
};
|
||||
|
||||
/**
|
||||
* Progress through a multi-step flow: a visible "step N of M" line and an
|
||||
* ordered list joined by a trace. The current step has aria-current="step";
|
||||
* each step states its status in text, so the shape and color only repeat it.
|
||||
*/
|
||||
export function Stepper({ label, steps }: StepperProps) {
|
||||
const currentIndex = steps.findIndex((step) => step.status === "current");
|
||||
const completed = steps.filter((step) => step.status === "complete").length;
|
||||
const position = currentIndex === -1 ? completed : currentIndex + 1;
|
||||
|
||||
return (
|
||||
<div className={styles.root}>
|
||||
<p className={styles.summary}>
|
||||
{currentIndex === -1 && completed === steps.length
|
||||
? `Все шаги выполнены: ${steps.length} из ${steps.length}`
|
||||
: `Шаг ${position} из ${steps.length}`}
|
||||
</p>
|
||||
<ol className={styles.list} aria-label={label}>
|
||||
{steps.map((step, index) => (
|
||||
<li
|
||||
key={step.id}
|
||||
className={styles.step}
|
||||
data-status={step.status}
|
||||
aria-current={step.status === "current" ? "step" : undefined}
|
||||
>
|
||||
<span className={styles.marker} aria-hidden="true">
|
||||
{step.status === "complete" ? "✓" : index + 1}
|
||||
</span>
|
||||
<span className={styles.label}>
|
||||
{step.label}
|
||||
<VisuallyHidden>{`, ${statusText[step.status]}`}</VisuallyHidden>
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user