Skip to content

Commit 8abcad6

Browse files
committed
1 parent 4cd94bb commit 8abcad6

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/Stepper.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export type StepperProps = {
1616
nextTitle?: ReactNode;
1717
classes?: Partial<Record<"root" | "title" | "state" | "steps" | "details", string>>;
1818
style?: CSSProperties;
19+
progressText?: (params: { currentStep: number; stepCount: number }) => ReactNode;
20+
nextStepText?: ReactNode;
1921
};
2022

2123
/** @see <https://components.react-dsfr.codegouv.studio/?path=/docs/components-stepper> */
@@ -30,6 +32,8 @@ export const Stepper = memo(
3032
nextTitle,
3133
classes = {},
3234
style,
35+
progressText,
36+
nextStepText,
3337
...rest
3438
} = props;
3539

@@ -52,7 +56,9 @@ export const Stepper = memo(
5256
<h2 className={cx(fr.cx("fr-stepper__title"), classes.title)}>
5357
{title}
5458
<span className={cx(fr.cx("fr-stepper__state"), classes.state)}>
55-
{t("progress", { currentStep, stepCount })}
59+
{progressText !== undefined
60+
? progressText({ currentStep, stepCount })
61+
: t("progress", { currentStep, stepCount })}
5662
</span>
5763
</h2>
5864
<div
@@ -62,7 +68,10 @@ export const Stepper = memo(
6268
></div>
6369
{nextTitle !== undefined && (
6470
<p className={cx(fr.cx("fr-stepper__details"), classes.details)}>
65-
<span className={fr.cx("fr-text--bold")}>{t("next step")}</span> {nextTitle}
71+
<span className={fr.cx("fr-text--bold")}>
72+
{nextStepText !== undefined ? nextStepText : t("next step")}
73+
</span>{" "}
74+
{nextTitle}
6675
</p>
6776
)}
6877
</div>

0 commit comments

Comments
 (0)