1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-31 13:47:02 +02: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, open: true,
}; };
export const Step4 = Template.bind({});
Step4.args = {
seedData: {
currentStep: 4,
},
open: true,
};
export const Closed = Template.bind({}); export const Closed = Template.bind({});

View File

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