aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/forms/comment-form
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-09-29 11:47:06 +0200
committerArmand Philippot <git@armandphilippot.com>2023-10-24 12:25:00 +0200
commit81b1e0e05919eb368a66aef47adcf7738af76f29 (patch)
tree758577d3f58d7025f84bca5bac9bc0da8432deb7 /src/components/organisms/forms/comment-form
parent3272ac336da52364ace5ed76d8f609d4088ffc06 (diff)
refactor(components): rewrite Spinner component
* Message should be set as children * Default message is no longer available (depending on use case, the consumer might prefer aria-label instead) * It is now possible to define the message position
Diffstat (limited to 'src/components/organisms/forms/comment-form')
-rw-r--r--src/components/organisms/forms/comment-form/comment-form.tsx16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/components/organisms/forms/comment-form/comment-form.tsx b/src/components/organisms/forms/comment-form/comment-form.tsx
index e645ede..b5f2d64 100644
--- a/src/components/organisms/forms/comment-form/comment-form.tsx
+++ b/src/components/organisms/forms/comment-form/comment-form.tsx
@@ -117,6 +117,12 @@ export const CommentForm: FC<CommentFormProps> = ({
id: 'dz2kDV',
});
+ const loadingMsg = intl.formatMessage({
+ defaultMessage: 'Submitting...',
+ description: 'CommentForm: spinner message on submit',
+ id: 'IY5ew6',
+ });
+
const formAriaLabel = title ? undefined : formTitle;
const formId = useId();
const formLabelledBy = title ? formId : undefined;
@@ -246,15 +252,7 @@ export const CommentForm: FC<CommentFormProps> = ({
id: 'OL0Yzx',
})}
</Button>
- {isSubmitting ? (
- <Spinner
- message={intl.formatMessage({
- defaultMessage: 'Submitting...',
- description: 'CommentForm: spinner message on submit',
- id: 'IY5ew6',
- })}
- />
- ) : null}
+ {isSubmitting ? <Spinner>{loadingMsg}</Spinner> : null}
{Notice}
</Form>
);