1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2025-04-25 08:46:39 +02:00

docs: Update SubmitButton component

Change loading label and add to documentation.
This commit is contained in:
Aleksandr Gumroian 2025-04-17 17:14:39 +02:00
parent ff13566f2a
commit 7afbd07ab4
No known key found for this signature in database
GPG Key ID: 9E77849C64F0A733
2 changed files with 16 additions and 1 deletions

View File

@ -18,8 +18,11 @@ export const STATES = {
};
SubmitButton.propTypes = {
/** Disable button */
disabled: PropTypes.bool,
/** Button state */
state: PropTypes.oneOf(Object.keys(STATES).map((key) => STATES[key])),
/** Button label */
label: PropTypes.string,
};
@ -34,7 +37,7 @@ export function SubmitButton({ disabled, state, label, ...props }) {
labelSubmitButton = _("Updating");
break;
case STATES.LOAD:
labelSubmitButton = _("Load settings");
labelSubmitButton = _("Loading");
break;
default:
labelSubmitButton = _("Save");

View 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} />
```