From 7afbd07ab482480d10c614734abf9a6b1c70ec11 Mon Sep 17 00:00:00 2001 From: Aleksandr Gumroian Date: Thu, 17 Apr 2025 17:14:39 +0200 Subject: [PATCH] docs: Update SubmitButton component Change loading label and add to documentation. --- src/form/components/SubmitButton.js | 5 ++++- src/form/components/SubmitButton.md | 12 ++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 src/form/components/SubmitButton.md diff --git a/src/form/components/SubmitButton.js b/src/form/components/SubmitButton.js index f567569..ce54b83 100644 --- a/src/form/components/SubmitButton.js +++ b/src/form/components/SubmitButton.js @@ -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"); diff --git a/src/form/components/SubmitButton.md b/src/form/components/SubmitButton.md new file mode 100644 index 0000000..9c8f8aa --- /dev/null +++ b/src/form/components/SubmitButton.md @@ -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 + + + + + + + +```