diff --git a/packages/code-du-travail-frontend/src/outils/IndemniteLicenciement/Wizard.js b/packages/code-du-travail-frontend/src/outils/IndemniteLicenciement/Wizard.js
index 14204da8f4..eae7892589 100644
--- a/packages/code-du-travail-frontend/src/outils/IndemniteLicenciement/Wizard.js
+++ b/packages/code-du-travail-frontend/src/outils/IndemniteLicenciement/Wizard.js
@@ -1,4 +1,4 @@
-import React, { useState } from "react";
+import React, { useState, useReducer } from "react";
import PropTypes from "prop-types";
import styled from "styled-components";
import { Form } from "react-final-form";
@@ -9,14 +9,14 @@ import { StepItems } from "./StepItems";
import { PrevNextBar } from "./PrevNextBar";
function Wizard({
- initialValues = {},
+ initialSteps,
initialStepIndex = 0,
- steps,
- onSubmit,
- onUpdate,
- rules = null
+ initialValues = {},
+ Rules = null,
+ stepReducer
}) {
const [stepIndex, setStepIndex] = useState(initialStepIndex);
+ const [steps, dispatch] = useReducer(stepReducer, initialSteps);
const prevStep = () => {
setStepIndex(Math.max(0, stepIndex - 1));
@@ -36,12 +36,13 @@ function Wizard({
const handlePageSubmit = (values, form) => {
// This means the user clicked on a "restart a new simulation" button
if (stepIndex === steps.length - 1) {
- onSubmit(values);
form.reset();
+ dispatch({
+ type: "reset"
+ });
setStepIndex(0);
} else {
nextStep();
- onUpdate && onUpdate(values);
}
};
const stepItems = steps.map(({ name, label }) => ({
@@ -71,7 +72,9 @@ function Wizard({
return (
<>
`;
exports[` should inject rules component 1`] = `
-.c4 {
+.c6 {
max-width: 1200px;
margin: 0 auto;
padding: 0 1.25rem;
@@ -645,11 +776,11 @@ exports[` should inject rules component 1`] = `
max-width: 46.25rem;
}
-.c4 > *:first-child {
+.c6 > *:first-child {
margin-top: 0;
}
-.c4 > *:last-child {
+.c6 > *:last-child {
margin-bottom: 0;
}
@@ -686,6 +817,26 @@ exports[` should inject rules component 1`] = `
line-height: 1;
}
+.c3 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ width: 8.4375rem;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ padding: 0 0.25rem;
+ font-size: 0.875rem;
+ text-align: left;
+ color: #adb9c9;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ font-weight: 600;
+ line-height: 1;
+}
+
.c2 {
border-radius: 49%;
-webkit-flex-shrink: 0;
@@ -711,7 +862,32 @@ exports[` should inject rules component 1`] = `
background-color: #0053b3;
}
-.c5 {
+.c4 {
+ border-radius: 49%;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ height: 1.6rem;
+ width: 1.6rem;
+ margin: 0.5rem 0.625rem;
+ margin-left: 0;
+ color: #fff;
+ background-color: #adb9c9;
+}
+
+.c7 {
margin-bottom: 0.625rem;
display: -webkit-box;
display: -webkit-flex;
@@ -723,48 +899,379 @@ exports[` should inject rules component 1`] = `
justify-content: space-between;
}
-.c3 {
- margin-top: 2rem;
- margin-bottom: 2rem;
+.c8 {
+ padding: 0.625rem 1rem;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ text-align: center;
+ line-height: inherit;
+ font-size: 1rem;
+ font-weight: 600;
+ vertical-align: middle;
+ border-style: solid;
+ border-width: 1px 1px 2px 1px;
+ border-radius: 0.25rem;
+ cursor: pointer;
+ -webkit-transition: background-color 250ms ease;
+ transition: background-color 250ms ease;
+ color: #fff;
+ background: #005994;
+ border-color: #005994;
+ border-bottom-color: #003a61;
+ margin-left: auto;
}
-@media print {
- .c4 {
- max-width: 100%;
- padding: 0;
- }
+.c8:not([disabled]):hover,
+.c8:not([disabled]):focus {
+ background: #0068ae;
+ color: #fff;
}
-