1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

step forward after submitting response

This commit is contained in:
Thomas Heartman 2022-02-28 22:29:27 +01:00
parent 5c35ea84b7
commit 0e4d2cf102
2 changed files with 16 additions and 4 deletions

View File

@ -29,4 +29,12 @@ Step3.args = {
open: true,
};
export const Step4 = Template.bind({});
Step4.args = {
seedData: {
currentStep: 4,
},
open: true,
};
export const Closed = Template.bind({});

View File

@ -14,7 +14,7 @@ export const initialData = {
};
const fetchData = (initialData) => {
const localstorageKey = 'user-feedback';
const localstorageKey = 'user-feedback-v1';
return {
currentStep: 1,
@ -54,7 +54,7 @@ const stateReducer = (state, message) => {
case 'step forward':
return {
...state,
currentStep: Math.min(state.currentStep + 1, 3),
currentStep: Math.min(state.currentStep + 1, 4),
};
case 'step back':
return {
@ -91,6 +91,7 @@ export const FeedbackWrapper = ({ seedData, open }) => {
const submitFeedback = () => {
console.log('send feedback here ');
stepForward();
};
const visuallyHidden = (stepNumber) => state.currentStep !== stepNumber;
@ -320,12 +321,15 @@ export const FeedbackWrapper = ({ seedData, open }) => {
};
const Step4 = () => {
const hidden = isHidden(4);
return (
<div>
<div className={visuallyHidden(4) ? styles['invisible'] : ''}>
<p className={styles['thank-you']}>Thank you! 🙌</p>
<button
className={styles['button-secondary']}
disabled={hidden}
onClick={() => setFeedbackIsOpen(false)}
autoFocus
>
close
</button>
@ -373,7 +377,7 @@ export const FeedbackWrapper = ({ seedData, open }) => {
<Step1 />
<Step2 />
<Step3 />
{/* <Step4 /> */}
<Step4 />
</div>
</article>
</div>