diff --git a/website/src/components/UserFeedback/index.jsx b/website/src/components/UserFeedback/index.jsx index cd53804837..518d383f91 100644 --- a/website/src/components/UserFeedback/index.jsx +++ b/website/src/components/UserFeedback/index.jsx @@ -92,217 +92,260 @@ export const FeedbackWrapper = ({ seedData, open }) => { console.log('send feedback here '); }; + const step1ref = React.useRef(null); + + const visuallyHidden = (stepNumber) => state.currentStep !== stepNumber; + const isHidden = (stepNumber) => + !feedbackIsOpen || visuallyHidden(stepNumber); + const Step1 = () => { + const hidden = isHidden(1); const [newValue, setNewValue] = React.useState(undefined); return (
{ e.preventDefault(); setScore(newValue); stepForward(); }} + aria-hidden={hidden} > -

- - On a scale from 1 to 5 where 1 is very unsatisfied and 5 - is very satisfied, - {' '} - How would you rate your overall satisfaction with the - Unleash documentation? -

+
+

+ + On a scale from 1 to 5 where 1 is very unsatisfied + and 5 is very satisfied, + {' '} + How would you rate your overall satisfaction with the + Unleash documentation? +

-
- - - {[1, 2, 3, 4, 5].map((n) => ( - - { - const value = parseInt(e.target.value); - console.log('the value is', value); - setNewValue(value); - }} - /> - - - ))} - - -
-
- -
+
+ + + {[1, 2, 3, 4, 5].map((n) => ( + + { + const value = parseInt( + e.target.value, + ); + console.log('the value is', value); + setNewValue(value); + }} + /> + + + ))} + + +
+
+ +
+
); }; const Step2 = () => { + const hidden = isHidden(2); const textareaId = 'feedback-comment-input'; const saveComment = () => setComment(document.getElementById(textareaId).value); return (
{ e.preventDefault(); saveComment(); stepForward(); }} > - - +
+ + -
- - - -
+
+ + + +
+
); }; const Step3 = () => { + const hidden = isHidden(3); const [value, setValue] = React.useState(); return (
{ e.preventDefault(); setCustomerType(value); submitFeedback(); }} > - - Finally, would you mind telling us a little about yourself? - What kind of customer are you? - -
- {[ - ['a', 'paying', 'paying'], - ['an', 'open source', 'opensource'], - ].map(([article, customerType, key]) => ( - - { - const value = e.target.value; - setValue(value); - }} - /> - - - ))} -
+
+ + Finally, would you mind telling us a little about + yourself? What kind of customer are you? + +
+ {[ + ['a', 'paying', 'paying'], + ['an', 'open source', 'opensource'], + ].map(([article, customerType, key]) => ( + + { + const value = e.target.value; + setValue(value); + }} + /> + + + ))} +
-
- - -
+
+ + +
+
); }; + + const Step4 = () => { + return

Thank you! 🙌

; + }; + return (

feedback is {feedbackIsOpen ? 'open' : 'closed'}

+
); diff --git a/website/src/components/UserFeedback/styles.module.css b/website/src/components/UserFeedback/styles.module.css index e58eb09097..7646179f6b 100644 --- a/website/src/components/UserFeedback/styles.module.css +++ b/website/src/components/UserFeedback/styles.module.css @@ -2,6 +2,17 @@ --outline-style: 2px solid var(--ifm-color-primary); --row-gap: 1rem; --element-horizontal-gap: 1rem; + + --animation-duration: 0.25s; + --fade-out-transition: opacity var(--animation-duration); + --fade-in-transition: opacity var(--animation-duration) + calc(var(--animation-duration) / 2); +} + +@media screen and (prefers-reduced-motion: reduced) { + .user-feedback-container { + --animation-duration: 0; + } } .user-feedback { @@ -14,6 +25,12 @@ box-shadow: var(--ifm-global-shadow-lw); padding: var(--ifm-spacing-vertical) var(--ifm-spacing-horizontal); text-align: center; + transition: var(--fade-in-transition); +} + +.user-feedback fieldset { + border: none; + padding: 0; } .user-feedback > * + * { @@ -30,13 +47,14 @@ max-width: 850px; margin-left: auto; margin-right: auto; + transition: var(--fade-in-transition); + opacity: 1; } .user-feedback > form > * + * { margin-top: var(--row-gap); } - .hidden { display: none; } @@ -147,11 +165,13 @@ button.close-button { padding-inline: calc(var(--ifm-spacing-horizontal) * 4); } -.primary-button:hover, .user-feedback button[type='submit']:hover { +.primary-button:hover, +.user-feedback button[type='submit']:hover { background-color: var(--ifm-color-primary-lighter); } -.primary-button:hover, .user-feedback button[type='submit']:active { +.primary-button:hover, +.user-feedback button[type='submit']:active { background-color: var(--ifm-color-primary-dark); } @@ -174,14 +194,12 @@ button.close-button { background-color: var(--ifm-background-color); color: currentColor; border-radius: var(--ifm-global-radius); - border: var(--ifm-global-border-width) solid - var(--ifm-color-emphasis-400); + border: var(--ifm-global-border-width) solid var(--ifm-color-emphasis-400); font-style: normal; font-family: inherit; padding: var(--ifm-spacing-vertical) var(--ifm-spacing-horizontal); } - .customer-type-inputs { display: flex; justify-content: center;