Skip to content

Commit 724ab32

Browse files
committed
extract InlineLoadingSpinner
1 parent 74637ae commit 724ab32

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

components/Form/MultiStepForm.tsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,8 @@ import Button from 'components/Buttons/Button/Button';
1414
import Form from 'components/Form/Form';
1515
import Alert from 'components/Alert/Alert';
1616
import ProgressIndicator from 'components/ProgressIndicator/ProgressIndicator';
17-
import { twMerge } from 'tailwind-merge';
1817
import type { OptionType } from 'components/Form/Select/ThemedReactSelect';
19-
20-
const InlineLoadingSpinner = ({ className }: { className?: string }) => (
21-
<span
22-
aria-hidden
23-
className={twMerge(
24-
'border-solid border-white border-4 !border-b-themePrimary rounded-[50%] h-5 w-5 box-border animate-spin group-hover:border-themeSecondary transition-colors',
25-
className,
26-
)}
27-
/>
28-
);
18+
import { InlineLoadingSpinner } from 'components/InlineLoadingSpinner';
2919

3020
interface MultiStepFormProps<T> {
3121
initialValues: T;

components/Forms/RegistrationForm/RegistrationForm.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import Link from 'next/link';
1313
import OutboundLink from 'components/OutboundLink/OutboundLink';
1414
import type { AxiosError } from 'axios';
1515
import axios from 'axios';
16+
import { InlineLoadingSpinner } from 'components/InlineLoadingSpinner';
1617

1718
export interface RegistrationFormValues {
1819
email: string;
@@ -222,7 +223,10 @@ export function RegistrationForm({
222223

223224
<div className="max-w-md px-3 mt-5">
224225
<Button type="submit" theme="secondary" disabled={isSubmitting}>
225-
Submit
226+
<span className="flex items-center justify-center gap-x-2">
227+
{isSubmitting && <InlineLoadingSpinner />}
228+
<span className="mt-[0.325rem]">Submit ✓</span>
229+
</span>
226230
</Button>
227231
<p className="pt-5 text-xs">
228232
The demographic information you provide, helps us understand our community needs,

components/InlineLoadingSpinner.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { twMerge } from 'tailwind-merge';
2+
3+
interface InlineLoadingSpinnerProps {
4+
className?: string;
5+
}
6+
7+
export const InlineLoadingSpinner = ({ className }: InlineLoadingSpinnerProps) => (
8+
<span
9+
aria-hidden
10+
className={twMerge(
11+
'border-solid border-white border-4 !border-b-themePrimary rounded-[50%] h-5 w-5 box-border animate-spin group-hover:border-themeSecondary transition-colors',
12+
className,
13+
)}
14+
/>
15+
);

0 commit comments

Comments
 (0)