mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-10-26 22:00:31 +01:00 
			
		
		
		
	Update SubmitButton component: change loading label and add documentation
This commit is contained in:
		| @@ -18,8 +18,11 @@ export const STATES = { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| SubmitButton.propTypes = { | SubmitButton.propTypes = { | ||||||
|  |     /** Disable button */ | ||||||
|     disabled: PropTypes.bool, |     disabled: PropTypes.bool, | ||||||
|  |     /** Button state */ | ||||||
|     state: PropTypes.oneOf(Object.keys(STATES).map((key) => STATES[key])), |     state: PropTypes.oneOf(Object.keys(STATES).map((key) => STATES[key])), | ||||||
|  |     /** Button label */ | ||||||
|     label: PropTypes.string, |     label: PropTypes.string, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -34,7 +37,7 @@ export function SubmitButton({ disabled, state, label, ...props }) { | |||||||
|                 labelSubmitButton = _("Updating"); |                 labelSubmitButton = _("Updating"); | ||||||
|                 break; |                 break; | ||||||
|             case STATES.LOAD: |             case STATES.LOAD: | ||||||
|                 labelSubmitButton = _("Load settings"); |                 labelSubmitButton = _("Loading"); | ||||||
|                 break; |                 break; | ||||||
|             default: |             default: | ||||||
|                 labelSubmitButton = _("Save"); |                 labelSubmitButton = _("Save"); | ||||||
|   | |||||||
							
								
								
									
										12
									
								
								src/form/components/SubmitButton.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/form/components/SubmitButton.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | |||||||
|  | SubmitButton is a component that renders a button with different states based on | ||||||
|  | the `state` prop. It can be used to indicate the status of a form submission. | ||||||
|  |  | ||||||
|  | ```jsx padded | ||||||
|  | <SubmitButton state={1} /> | ||||||
|  |  | ||||||
|  | <SubmitButton state={2} /> | ||||||
|  |  | ||||||
|  | <SubmitButton state={3} /> | ||||||
|  |  | ||||||
|  | <SubmitButton label="Submitting" state={2} /> | ||||||
|  | ``` | ||||||
		Reference in New Issue
	
	Block a user