create-brainerce-store 1.67.0 → 1.71.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/index.js +22 -2
  2. package/messages/en.json +52 -2
  3. package/messages/he.json +52 -2
  4. package/package.json +1 -1
  5. package/templates/nextjs/base/.env.local.ejs +7 -0
  6. package/templates/nextjs/base/AGENTS.md.ejs +7 -0
  7. package/templates/nextjs/base/CLAUDE.md.ejs +7 -0
  8. package/templates/nextjs/base/src/app/blog/[slug]/page.tsx.ejs +8 -2
  9. package/templates/nextjs/base/src/app/category/[slug]/page.tsx +16 -7
  10. package/templates/nextjs/base/src/app/checkout/page.tsx +1018 -1017
  11. package/templates/nextjs/base/src/app/error.tsx.ejs +53 -0
  12. package/templates/nextjs/base/src/app/pages/[slug]/page.tsx.ejs +8 -2
  13. package/templates/nextjs/base/src/app/products/[slug]/page.tsx +17 -7
  14. package/templates/nextjs/base/src/app/register/page.tsx +67 -64
  15. package/templates/nextjs/base/src/components/account/profile-section.tsx +303 -226
  16. package/templates/nextjs/base/src/components/auth/register-form.tsx +326 -245
  17. package/templates/nextjs/base/src/components/checkout/custom-fields-step.tsx +306 -294
  18. package/templates/nextjs/base/src/components/checkout/date-picker.tsx +13 -1
  19. package/templates/nextjs/base/src/components/checkout/datetime-picker.tsx +61 -21
  20. package/templates/nextjs/base/src/components/shared/birthday-picker.tsx +258 -0
  21. package/templates/nextjs/base/src/core/lib/auth.ts +162 -154
  22. package/templates/nextjs/base/src/core/lib/birthday.ts +74 -0
  23. package/templates/nextjs/base/src/core/lib/site-url.ts +42 -9
  24. package/templates/nextjs/base/src/core/lib/store-info.ts +10 -0
  25. package/templates/nextjs/base/src/ui/layout/newsletter-signup.tsx +143 -0
  26. package/templates/nextjs/base/src/ui/layout/site-footer.tsx.ejs +18 -2
  27. package/templates/nextjs/base/src/ui/product/back-in-stock-form.tsx +173 -0
  28. package/templates/nextjs/base/src/ui/product/product-client-section.tsx +484 -455
  29. package/templates/nextjs/base/src/ui/product/review-form.tsx +136 -12
  30. package/templates/nextjs/base/src/ui/product/reviews-section.tsx.ejs +139 -108
  31. package/templates/nextjs/designs/atelier/ui/layout/site-footer.tsx.ejs +155 -142
  32. package/templates/nextjs/designs/atelier/ui/product/product-client-section.tsx +500 -477
  33. package/templates/nextjs/designs/atelier/ui/product/review-form.tsx +135 -11
  34. package/templates/nextjs/designs/atelier/ui/product/reviews-section.tsx.ejs +179 -148
  35. package/templates/nextjs/ui-canvas/layout/newsletter-signup.tsx +122 -0
  36. package/templates/nextjs/ui-canvas/layout/site-footer.tsx.ejs +87 -83
  37. package/templates/nextjs/ui-canvas/product/back-in-stock-form.tsx +151 -0
  38. package/templates/nextjs/ui-canvas/product/product-client-section.tsx +373 -352
  39. package/templates/nextjs/ui-canvas/product/review-form.tsx +129 -11
  40. package/templates/nextjs/ui-canvas/product/reviews-section.tsx.ejs +127 -96
@@ -1,245 +1,326 @@
1
- 'use client';
2
-
3
- import { useState, useMemo } from 'react';
4
- import { useTranslations } from '@/core/lib/translations';
5
- import { cn } from '@/core/lib/utils';
6
- import { LoadingSpinner } from '@/ui/shared/loading-spinner';
7
- import { getPasswordError } from '@/core/lib/validation';
8
-
9
- interface RegisterData {
10
- firstName: string;
11
- lastName: string;
12
- email: string;
13
- password: string;
14
- acceptsMarketing: boolean;
15
- }
16
-
17
- interface RegisterFormProps {
18
- onSubmit: (data: RegisterData) => Promise<void>;
19
- error?: string | null;
20
- className?: string;
21
- }
22
-
23
- function getPasswordStrength(password: string): { label: string; color: string; width: string } {
24
- if (password.length === 0) return { label: '', color: '', width: 'w-0' };
25
- if (password.length < 8) return { label: 'tooShort', color: 'bg-destructive', width: 'w-1/4' };
26
-
27
- let score = 0;
28
- if (password.length >= 8) score++;
29
- if (/[A-Z]/.test(password)) score++;
30
- if (/[0-9]/.test(password)) score++;
31
- if (/[^A-Za-z0-9]/.test(password)) score++;
32
-
33
- if (score <= 1) return { label: 'weak', color: 'bg-orange-500', width: 'w-1/3' };
34
- if (score <= 2) return { label: 'fair', color: 'bg-yellow-500', width: 'w-1/2' };
35
- if (score <= 3) return { label: 'good', color: 'bg-primary', width: 'w-3/4' };
36
- return { label: 'strong', color: 'bg-green-500', width: 'w-full' };
37
- }
38
-
39
- export function RegisterForm({ onSubmit, error, className }: RegisterFormProps) {
40
- const t = useTranslations('auth');
41
- const tf = useTranslations('checkoutForm');
42
- const [firstName, setFirstName] = useState('');
43
- const [lastName, setLastName] = useState('');
44
- const [email, setEmail] = useState('');
45
- const [password, setPassword] = useState('');
46
- const [privacyAccepted, setPrivacyAccepted] = useState(false);
47
- const [privacyError, setPrivacyError] = useState(false);
48
- const [passwordError, setPasswordError] = useState<string | null>(null);
49
- const [acceptsMarketing, setAcceptsMarketing] = useState(false);
50
- const [loading, setLoading] = useState(false);
51
-
52
- const strength = useMemo(() => getPasswordStrength(password), [password]);
53
-
54
- async function handleSubmit(e: React.FormEvent) {
55
- e.preventDefault();
56
- if (loading) return;
57
-
58
- const pwCode = getPasswordError(password);
59
- if (pwCode) {
60
- setPasswordError(t(pwCode));
61
- return;
62
- }
63
- setPasswordError(null);
64
-
65
- if (!privacyAccepted) {
66
- setPrivacyError(true);
67
- return;
68
- }
69
-
70
- try {
71
- setLoading(true);
72
- await onSubmit({ firstName, lastName, email, password, acceptsMarketing });
73
- } finally {
74
- setLoading(false);
75
- }
76
- }
77
-
78
- return (
79
- <form onSubmit={handleSubmit} className={cn('space-y-4', className)}>
80
- {error && (
81
- <div className="bg-destructive/10 border-destructive/20 text-destructive rounded-lg border px-4 py-3 text-sm">
82
- {error}
83
- </div>
84
- )}
85
-
86
- <div className="grid grid-cols-2 gap-3">
87
- <div>
88
- <label
89
- htmlFor="register-first-name"
90
- className="text-foreground mb-1.5 block text-sm font-medium"
91
- >
92
- {tf('firstName')}
93
- </label>
94
- <input
95
- id="register-first-name"
96
- type="text"
97
- required
98
- value={firstName}
99
- onChange={(e) => setFirstName(e.target.value)}
100
- placeholder={t('firstNamePlaceholder')}
101
- autoComplete="given-name"
102
- className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
103
- />
104
- </div>
105
-
106
- <div>
107
- <label
108
- htmlFor="register-last-name"
109
- className="text-foreground mb-1.5 block text-sm font-medium"
110
- >
111
- {tf('lastName')}
112
- </label>
113
- <input
114
- id="register-last-name"
115
- type="text"
116
- required
117
- value={lastName}
118
- onChange={(e) => setLastName(e.target.value)}
119
- placeholder={t('lastNamePlaceholder')}
120
- autoComplete="family-name"
121
- className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
122
- />
123
- </div>
124
- </div>
125
-
126
- <div>
127
- <label
128
- htmlFor="register-email"
129
- className="text-foreground mb-1.5 block text-sm font-medium"
130
- >
131
- {t('email')}
132
- </label>
133
- <input
134
- id="register-email"
135
- type="email"
136
- required
137
- value={email}
138
- onChange={(e) => setEmail(e.target.value)}
139
- placeholder={t('emailPlaceholder')}
140
- autoComplete="email"
141
- className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
142
- />
143
- </div>
144
-
145
- <div>
146
- <label
147
- htmlFor="register-password"
148
- className="text-foreground mb-1.5 block text-sm font-medium"
149
- >
150
- {t('password')}
151
- </label>
152
- <input
153
- id="register-password"
154
- type="password"
155
- required
156
- minLength={8}
157
- value={password}
158
- onChange={(e) => {
159
- setPassword(e.target.value);
160
- if (passwordError) setPasswordError(null);
161
- }}
162
- placeholder={t('atLeastChars')}
163
- autoComplete="new-password"
164
- className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
165
- />
166
- {password.length > 0 && (
167
- <div className="mt-2">
168
- <div className="bg-muted h-1.5 w-full overflow-hidden rounded-full">
169
- <div
170
- className={cn(
171
- 'h-full rounded-full transition-all duration-300',
172
- strength.color,
173
- strength.width
174
- )}
175
- />
176
- </div>
177
- <p className="text-muted-foreground mt-1 text-xs">
178
- {strength.label
179
- ? t(strength.label as 'tooShort' | 'weak' | 'fair' | 'good' | 'strong')
180
- : ''}
181
- </p>
182
- </div>
183
- )}
184
- {passwordError && <p className="text-destructive mt-1 text-xs">{passwordError}</p>}
185
- </div>
186
-
187
- {/* Privacy Policy (required) */}
188
- <div>
189
- <label className="flex cursor-pointer items-start gap-2">
190
- <input
191
- type="checkbox"
192
- checked={privacyAccepted}
193
- onChange={(e) => {
194
- setPrivacyAccepted(e.target.checked);
195
- setPrivacyError(false);
196
- }}
197
- className="accent-primary mt-0.5"
198
- />
199
- <span className="text-muted-foreground text-sm">
200
- {t('privacyAcceptPrefix')}{' '}
201
- <a
202
- href="/privacy"
203
- target="_blank"
204
- rel="noopener noreferrer"
205
- className="text-primary underline underline-offset-2"
206
- >
207
- {t('privacyPolicyLink')}
208
- </a>{' '}
209
- <span className="text-destructive">*</span>
210
- </span>
211
- </label>
212
- {privacyError && <p className="text-destructive mt-1 text-xs">{t('privacyRequired')}</p>}
213
- </div>
214
-
215
- {/* Marketing consent (optional) */}
216
- <label className="flex cursor-pointer items-start gap-2">
217
- <input
218
- type="checkbox"
219
- checked={acceptsMarketing}
220
- onChange={(e) => setAcceptsMarketing(e.target.checked)}
221
- className="accent-primary mt-0.5"
222
- />
223
- <span className="text-muted-foreground text-sm">{t('acceptsMarketing')}</span>
224
- </label>
225
-
226
- <button
227
- type="submit"
228
- disabled={loading}
229
- className="bg-primary text-primary-foreground flex h-10 w-full items-center justify-center gap-2 rounded text-sm font-medium transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50"
230
- >
231
- {loading ? (
232
- <>
233
- <LoadingSpinner
234
- size="sm"
235
- className="border-primary-foreground/30 border-t-primary-foreground"
236
- />
237
- {t('creatingAccount')}
238
- </>
239
- ) : (
240
- t('createAccount')
241
- )}
242
- </button>
243
- </form>
244
- );
245
- }
1
+ 'use client';
2
+
3
+ import { useState, useMemo } from 'react';
4
+ import { useTranslations } from '@/core/lib/translations';
5
+ import { cn } from '@/core/lib/utils';
6
+ import { LoadingSpinner } from '@/ui/shared/loading-spinner';
7
+ import { getPasswordError } from '@/core/lib/validation';
8
+ import { useStoreInfo } from '@/core/providers/store-provider';
9
+ import { toBirthdayNumber } from '@/core/lib/birthday';
10
+ import { BirthdayPicker } from '@/components/shared/birthday-picker';
11
+
12
+ interface RegisterData {
13
+ firstName: string;
14
+ lastName: string;
15
+ email: string;
16
+ password: string;
17
+ acceptsMarketing: boolean;
18
+ /**
19
+ * Birthday month and day, never a year. Sent together or left out entirely:
20
+ * one without the other is rejected with HTTP 400. Omitted rather than
21
+ * nulled when the shopper leaves the field empty, because `registerCustomer()`
22
+ * takes numbers only.
23
+ */
24
+ birthMonth?: number;
25
+ birthDay?: number;
26
+ }
27
+
28
+ interface RegisterFormProps {
29
+ onSubmit: (data: RegisterData) => Promise<void>;
30
+ error?: string | null;
31
+ className?: string;
32
+ }
33
+
34
+ function getPasswordStrength(password: string): { label: string; color: string; width: string } {
35
+ if (password.length === 0) return { label: '', color: '', width: 'w-0' };
36
+ if (password.length < 8) return { label: 'tooShort', color: 'bg-destructive', width: 'w-1/4' };
37
+
38
+ let score = 0;
39
+ if (password.length >= 8) score++;
40
+ if (/[A-Z]/.test(password)) score++;
41
+ if (/[0-9]/.test(password)) score++;
42
+ if (/[^A-Za-z0-9]/.test(password)) score++;
43
+
44
+ if (score <= 1) return { label: 'weak', color: 'bg-orange-500', width: 'w-1/3' };
45
+ if (score <= 2) return { label: 'fair', color: 'bg-yellow-500', width: 'w-1/2' };
46
+ if (score <= 3) return { label: 'good', color: 'bg-primary', width: 'w-3/4' };
47
+ return { label: 'strong', color: 'bg-green-500', width: 'w-full' };
48
+ }
49
+
50
+ export function RegisterForm({ onSubmit, error, className }: RegisterFormProps) {
51
+ const t = useTranslations('auth');
52
+ const tf = useTranslations('checkoutForm');
53
+ const tc = useTranslations('common');
54
+ const { storeInfo } = useStoreInfo();
55
+ const [firstName, setFirstName] = useState('');
56
+ const [lastName, setLastName] = useState('');
57
+ const [email, setEmail] = useState('');
58
+ const [password, setPassword] = useState('');
59
+ const [privacyAccepted, setPrivacyAccepted] = useState(false);
60
+ const [privacyError, setPrivacyError] = useState(false);
61
+ const [passwordError, setPasswordError] = useState<string | null>(null);
62
+ const [acceptsMarketing, setAcceptsMarketing] = useState(false);
63
+ const [birthMonth, setBirthMonth] = useState('');
64
+ const [birthDay, setBirthDay] = useState('');
65
+ const [birthdayError, setBirthdayError] = useState<string | null>(null);
66
+ const [loading, setLoading] = useState(false);
67
+
68
+ /**
69
+ * The merchant can make the birthday mandatory at registration on this sales
70
+ * channel; the backend then rejects a register call without it. The flag is a
71
+ * rendering hint only, and absent means optional, so the fields stay optional
72
+ * unless it is explicitly true.
73
+ */
74
+ const birthdayRequired = storeInfo?.requireBirthday === true;
75
+
76
+ const strength = useMemo(() => getPasswordStrength(password), [password]);
77
+
78
+ /**
79
+ * The picker hands back both halves at once, or two nulls when the shopper
80
+ * clears the field. State stays as strings so the submit path below is
81
+ * unchanged.
82
+ */
83
+ function selectBirthday(month: number | null, day: number | null) {
84
+ setBirthMonth(month ? String(month) : '');
85
+ setBirthDay(day ? String(day) : '');
86
+ setBirthdayError(null);
87
+ }
88
+
89
+ async function handleSubmit(e: React.FormEvent) {
90
+ e.preventDefault();
91
+ if (loading) return;
92
+
93
+ const pwCode = getPasswordError(password);
94
+ if (pwCode) {
95
+ setPasswordError(t(pwCode));
96
+ return;
97
+ }
98
+ setPasswordError(null);
99
+
100
+ const month = toBirthdayNumber(birthMonth);
101
+ const day = toBirthdayNumber(birthDay);
102
+
103
+ if (birthdayRequired && (month === null || day === null)) {
104
+ setBirthdayError(tc('birthdayRequired'));
105
+ return;
106
+ }
107
+ // Half a birthday is an HTTP 400 at the API, so catch it here rather than
108
+ // letting the shopper find out from a failed registration.
109
+ if ((month === null) !== (day === null)) {
110
+ setBirthdayError(tc('birthdayIncomplete'));
111
+ return;
112
+ }
113
+ setBirthdayError(null);
114
+
115
+ if (!privacyAccepted) {
116
+ setPrivacyError(true);
117
+ return;
118
+ }
119
+
120
+ try {
121
+ setLoading(true);
122
+ await onSubmit({
123
+ firstName,
124
+ lastName,
125
+ email,
126
+ password,
127
+ acceptsMarketing,
128
+ // Omitted, never nulled, when the shopper left the field empty:
129
+ // `registerCustomer()` takes numbers only.
130
+ ...(month !== null && day !== null ? { birthMonth: month, birthDay: day } : {}),
131
+ });
132
+ } finally {
133
+ setLoading(false);
134
+ }
135
+ }
136
+
137
+ return (
138
+ <form onSubmit={handleSubmit} className={cn('space-y-4', className)}>
139
+ {error && (
140
+ <div className="bg-destructive/10 border-destructive/20 text-destructive rounded-lg border px-4 py-3 text-sm">
141
+ {error}
142
+ </div>
143
+ )}
144
+
145
+ <div className="grid grid-cols-2 gap-3">
146
+ <div>
147
+ <label
148
+ htmlFor="register-first-name"
149
+ className="text-foreground mb-1.5 block text-sm font-medium"
150
+ >
151
+ {tf('firstName')}
152
+ </label>
153
+ <input
154
+ id="register-first-name"
155
+ type="text"
156
+ required
157
+ value={firstName}
158
+ onChange={(e) => setFirstName(e.target.value)}
159
+ placeholder={t('firstNamePlaceholder')}
160
+ autoComplete="given-name"
161
+ className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
162
+ />
163
+ </div>
164
+
165
+ <div>
166
+ <label
167
+ htmlFor="register-last-name"
168
+ className="text-foreground mb-1.5 block text-sm font-medium"
169
+ >
170
+ {tf('lastName')}
171
+ </label>
172
+ <input
173
+ id="register-last-name"
174
+ type="text"
175
+ required
176
+ value={lastName}
177
+ onChange={(e) => setLastName(e.target.value)}
178
+ placeholder={t('lastNamePlaceholder')}
179
+ autoComplete="family-name"
180
+ className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
181
+ />
182
+ </div>
183
+ </div>
184
+
185
+ <div>
186
+ <label
187
+ htmlFor="register-email"
188
+ className="text-foreground mb-1.5 block text-sm font-medium"
189
+ >
190
+ {t('email')}
191
+ </label>
192
+ <input
193
+ id="register-email"
194
+ type="email"
195
+ required
196
+ value={email}
197
+ onChange={(e) => setEmail(e.target.value)}
198
+ placeholder={t('emailPlaceholder')}
199
+ autoComplete="email"
200
+ className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
201
+ />
202
+ </div>
203
+
204
+ <div>
205
+ <label
206
+ htmlFor="register-password"
207
+ className="text-foreground mb-1.5 block text-sm font-medium"
208
+ >
209
+ {t('password')}
210
+ </label>
211
+ <input
212
+ id="register-password"
213
+ type="password"
214
+ required
215
+ minLength={8}
216
+ value={password}
217
+ onChange={(e) => {
218
+ setPassword(e.target.value);
219
+ if (passwordError) setPasswordError(null);
220
+ }}
221
+ placeholder={t('atLeastChars')}
222
+ autoComplete="new-password"
223
+ className="border-border bg-background text-foreground placeholder:text-muted-foreground focus:ring-primary/20 focus:border-primary h-10 w-full rounded border px-3 text-sm focus:outline-none focus:ring-2"
224
+ />
225
+ {password.length > 0 && (
226
+ <div className="mt-2">
227
+ <div className="bg-muted h-1.5 w-full overflow-hidden rounded-full">
228
+ <div
229
+ className={cn(
230
+ 'h-full rounded-full transition-all duration-300',
231
+ strength.color,
232
+ strength.width
233
+ )}
234
+ />
235
+ </div>
236
+ <p className="text-muted-foreground mt-1 text-xs">
237
+ {strength.label
238
+ ? t(strength.label as 'tooShort' | 'weak' | 'fair' | 'good' | 'strong')
239
+ : ''}
240
+ </p>
241
+ </div>
242
+ )}
243
+ {passwordError && <p className="text-destructive mt-1 text-xs">{passwordError}</p>}
244
+ </div>
245
+
246
+ {/* Birthday: month and day only, never a year. Optional unless the
247
+ merchant made it mandatory on this sales channel. */}
248
+ <div>
249
+ <label
250
+ htmlFor="register-birthday"
251
+ className="text-foreground mb-1.5 block text-sm font-medium"
252
+ >
253
+ {tc('birthday')}
254
+ {birthdayRequired && <span className="text-destructive"> *</span>}
255
+ </label>
256
+ <BirthdayPicker
257
+ id="register-birthday"
258
+ month={toBirthdayNumber(birthMonth)}
259
+ day={toBirthdayNumber(birthDay)}
260
+ onChange={selectBirthday}
261
+ required={birthdayRequired}
262
+ invalid={birthdayError !== null}
263
+ />
264
+ <p className="text-muted-foreground mt-1.5 text-xs">{tc('birthdayGiftNote')}</p>
265
+ {birthdayError && <p className="text-destructive mt-1 text-xs">{birthdayError}</p>}
266
+ </div>
267
+
268
+ {/* Privacy Policy (required) */}
269
+ <div>
270
+ <label className="flex cursor-pointer items-start gap-2">
271
+ <input
272
+ type="checkbox"
273
+ checked={privacyAccepted}
274
+ onChange={(e) => {
275
+ setPrivacyAccepted(e.target.checked);
276
+ setPrivacyError(false);
277
+ }}
278
+ className="accent-primary mt-0.5"
279
+ />
280
+ <span className="text-muted-foreground text-sm">
281
+ {t('privacyAcceptPrefix')}{' '}
282
+ <a
283
+ href="/privacy"
284
+ target="_blank"
285
+ rel="noopener noreferrer"
286
+ className="text-primary underline underline-offset-2"
287
+ >
288
+ {t('privacyPolicyLink')}
289
+ </a>{' '}
290
+ <span className="text-destructive">*</span>
291
+ </span>
292
+ </label>
293
+ {privacyError && <p className="text-destructive mt-1 text-xs">{t('privacyRequired')}</p>}
294
+ </div>
295
+
296
+ {/* Marketing consent (optional) */}
297
+ <label className="flex cursor-pointer items-start gap-2">
298
+ <input
299
+ type="checkbox"
300
+ checked={acceptsMarketing}
301
+ onChange={(e) => setAcceptsMarketing(e.target.checked)}
302
+ className="accent-primary mt-0.5"
303
+ />
304
+ <span className="text-muted-foreground text-sm">{t('acceptsMarketing')}</span>
305
+ </label>
306
+
307
+ <button
308
+ type="submit"
309
+ disabled={loading}
310
+ className="bg-primary text-primary-foreground flex h-10 w-full items-center justify-center gap-2 rounded text-sm font-medium transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50"
311
+ >
312
+ {loading ? (
313
+ <>
314
+ <LoadingSpinner
315
+ size="sm"
316
+ className="border-primary-foreground/30 border-t-primary-foreground"
317
+ />
318
+ {t('creatingAccount')}
319
+ </>
320
+ ) : (
321
+ t('createAccount')
322
+ )}
323
+ </button>
324
+ </form>
325
+ );
326
+ }