mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: start hooking up open/close logic
This commit is contained in:
		
							parent
							
								
									a629c36fe7
								
							
						
					
					
						commit
						9b1f9b764b
					
				| @ -10,7 +10,7 @@ const Template = (args) => <FeedbackWrapper {...args} />; | |||||||
| 
 | 
 | ||||||
| export const FullComponent = Template.bind({}); | export const FullComponent = Template.bind({}); | ||||||
| FullComponent.args = { | FullComponent.args = { | ||||||
|     // initialData, |     open: true, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const Step2 = Template.bind({}); | export const Step2 = Template.bind({}); | ||||||
| @ -18,6 +18,7 @@ Step2.args = { | |||||||
|     seedData: { |     seedData: { | ||||||
|         currentStep: 2, |         currentStep: 2, | ||||||
|     }, |     }, | ||||||
|  |     open: true, | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const Step3 = Template.bind({}); | export const Step3 = Template.bind({}); | ||||||
| @ -25,5 +26,7 @@ Step3.args = { | |||||||
|     seedData: { |     seedData: { | ||||||
|         currentStep: 3, |         currentStep: 3, | ||||||
|     }, |     }, | ||||||
|  |     open: true, | ||||||
| }; | }; | ||||||
|  | 
 | ||||||
| export const Closed = Template.bind({}); | export const Closed = Template.bind({}); | ||||||
|  | |||||||
| @ -65,8 +65,8 @@ const stateReducer = (state, message) => { | |||||||
|     return state; |     return state; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| export const FeedbackWrapper = ({ seedData }) => { | export const FeedbackWrapper = ({ seedData, open }) => { | ||||||
|     // const [feedbackIsOpen, setFeedbackIsOpen] = React.useState(false); |     const [feedbackIsOpen, setFeedbackIsOpen] = React.useState(open); | ||||||
| 
 | 
 | ||||||
|     const [state, dispatch] = React.useReducer( |     const [state, dispatch] = React.useReducer( | ||||||
|         stateReducer, |         stateReducer, | ||||||
| @ -274,10 +274,13 @@ export const FeedbackWrapper = ({ seedData }) => { | |||||||
|             </form> |             </form> | ||||||
|         ); |         ); | ||||||
|     }; |     }; | ||||||
|     return ( |     return feedbackIsOpen ? ( | ||||||
|         <article className={styles['user-feedback']}> |         <article className={styles['user-feedback']}> | ||||||
|             <div className={styles['close-button-row']}> |             <div className={styles['close-button-row']}> | ||||||
|                 <button className={styles['close-button']}> |                 <button | ||||||
|  |                     onClick={() => setFeedbackIsOpen(false)} | ||||||
|  |                     className={styles['close-button']} | ||||||
|  |                 > | ||||||
|                     <span className="visually-hidden"> |                     <span className="visually-hidden"> | ||||||
|                         close feedback popup |                         close feedback popup | ||||||
|                     </span> |                     </span> | ||||||
| @ -292,9 +295,21 @@ export const FeedbackWrapper = ({ seedData }) => { | |||||||
|                 <Step3 /> |                 <Step3 /> | ||||||
|             )} |             )} | ||||||
|         </article> |         </article> | ||||||
|  |     ) : ( | ||||||
|  |         <OpenFeedbackButton openFeedback={() => setFeedbackIsOpen(true)} /> | ||||||
|     ); |     ); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| const OpenFeedbackButton = ({ openFeedback }) => { | const OpenFeedbackButton = ({ openFeedback }) => { | ||||||
|     return <button onClick={openFeedback}>Feedback</button>; |     return ( | ||||||
|  |         <button | ||||||
|  |             className={join( | ||||||
|  |                 styles['open-feedback-button'], | ||||||
|  |                 styles['primary-button'], | ||||||
|  |             )} | ||||||
|  |             onClick={openFeedback} | ||||||
|  |         > | ||||||
|  |             Feedback | ||||||
|  |         </button> | ||||||
|  |     ); | ||||||
| }; | }; | ||||||
|  | |||||||
| @ -132,6 +132,7 @@ button.close-button { | |||||||
|     fill: currentColor; |     fill: currentColor; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | .primary-button, | ||||||
| .user-feedback button[type='submit'] { | .user-feedback button[type='submit'] { | ||||||
|     background-color: var(--ifm-color-primary); |     background-color: var(--ifm-color-primary); | ||||||
|     color: var(--ifm-background-color); |     color: var(--ifm-background-color); | ||||||
| @ -176,3 +177,15 @@ button.close-button { | |||||||
|     gap: var(--ifm-spacing-horizontal); |     gap: var(--ifm-spacing-horizontal); | ||||||
|     accent-color: var(--ifm-color-primary); |     accent-color: var(--ifm-color-primary); | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | .open-feedback-button { | ||||||
|  |     opacity: 0.55; | ||||||
|  |     padding-top: var(--ifm-spacing-vertical); | ||||||
|  |     padding-bottom: calc(var(--ifm-spacing-vertical) * 2); | ||||||
|  |     border-radius: var(--ifm-global-radius) var(--ifm-global-radius) 0 0; | ||||||
|  |     border: none; | ||||||
|  |     position: absolute; | ||||||
|  |     right: calc(var(--ifm-spacing-vertical) * -1); | ||||||
|  |     bottom: 25vh; | ||||||
|  |     transform: rotate(270deg); | ||||||
|  | } | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user