1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00

docs: set customer type correctly

This commit is contained in:
Thomas Heartman 2022-02-28 10:25:16 +01:00
parent 6916873ec7
commit 56d9335162

View File

@ -95,7 +95,14 @@ export const FeedbackWrapper = ({ seedData, open }) => {
const Step1 = () => { const Step1 = () => {
const [newValue, setNewValue] = React.useState(undefined); const [newValue, setNewValue] = React.useState(undefined);
return ( return (
<form className="step-1"> <form
className="step-1"
onSubmit={(e) => {
e.preventDefault();
setScore(newValue);
stepForward();
}}
>
<p> <p>
<span className="visually-hidden"> <span className="visually-hidden">
On a scale from 1 to 5 where 1 is very unsatisfied and 5 On a scale from 1 to 5 where 1 is very unsatisfied and 5
@ -151,17 +158,7 @@ export const FeedbackWrapper = ({ seedData, open }) => {
</span> </span>
</div> </div>
<div className={styles['button-container']}> <div className={styles['button-container']}>
<button <button type="submit">Next</button>
type="submit"
onSubmit={(e) => {
console.log(e, 'cancelable:', e.cancelable);
e.preventDefault();
setScore(newValue);
stepForward();
}}
>
Next
</button>
</div> </div>
</form> </form>
); );
@ -169,8 +166,18 @@ export const FeedbackWrapper = ({ seedData, open }) => {
const Step2 = () => { const Step2 = () => {
const textareaId = 'feedback-comment-input'; const textareaId = 'feedback-comment-input';
const saveComment = () =>
setComment(document.getElementById(textareaId).value);
return ( return (
<form className="step-2"> <form
className="step-2"
onSubmit={(e) => {
e.preventDefault();
saveComment();
stepForward();
}}
>
<label htmlFor={textareaId}> <label htmlFor={textareaId}>
What would you like to see improved in the Unleash What would you like to see improved in the Unleash
documentation? documentation?
@ -180,45 +187,49 @@ export const FeedbackWrapper = ({ seedData, open }) => {
/* cols="30" */ /* cols="30" */
name="" name=""
rows="5" rows="5"
></textarea> >
{state.data.comment}
</textarea>
<div className={styles['button-container']}> <div className={styles['button-container']}>
<button type="submit">Next</button>
<button <button
type="submit" className={styles['button-secondary']}
onSubmit={(e) => { type="button"
e.preventDefault(); onClick={() => {
setComment( saveComment();
document.getElementById(textareaId).value,
);
stepForward(); stepForward();
}} }}
> >
Next Skip
</button> </button>
<button <button
className={styles['button-secondary']} className={styles['button-secondary']}
type="button" type="button"
onClick={stepBack} onClick={() => {
saveComment();
stepBack();
}}
> >
Back Back
</button> </button>
<button
className={styles['button-secondary']}
type="button"
onClick={stepForward}
>
Skip
</button>
</div> </div>
</form> </form>
); );
}; };
const Step3 = () => { const Step3 = () => {
const [customerType, setCustomerType] = React.useState(); const [value, setValue] = React.useState();
return ( return (
<form className="step-3"> <form
className="step-3"
onSubmit={(e) => {
e.preventDefault();
setCustomerType(value);
submitFeedback();
}}
>
<span> <span>
Finally, would you mind telling us a little about yourself? Finally, would you mind telling us a little about yourself?
What kind of customer are you? What kind of customer are you?
@ -238,8 +249,7 @@ export const FeedbackWrapper = ({ seedData, open }) => {
defaultChecked={key === state.data.customerType} defaultChecked={key === state.data.customerType}
onChange={(e) => { onChange={(e) => {
const value = e.target.value; const value = e.target.value;
console.log('the value is', value); setValue(value);
setCustomerType(value);
}} }}
/> />
<label <label
@ -253,20 +263,14 @@ export const FeedbackWrapper = ({ seedData, open }) => {
</div> </div>
<div className={styles['button-container']}> <div className={styles['button-container']}>
<button <button type="submit">Submit feedback</button>
type="submit"
onSubmit={(e) => {
e.preventDefault();
setCustomerType(customerType);
submitFeedback();
}}
>
Submit feedback
</button>
<button <button
className={styles['button-secondary']} className={styles['button-secondary']}
type="button" type="button"
onClick={stepBack} onClick={() => {
setCustomerType(value);
stepBack();
}}
> >
Back Back
</button> </button>