AI store generator for ecommerce, Malaysia first. Laravel 13 + React + TypeScript.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

register.tsx 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. import { Form, Head } from '@inertiajs/react';
  2. import InputError from '@/components/input-error';
  3. import PasswordInput from '@/components/password-input';
  4. import TextLink from '@/components/text-link';
  5. import { Button } from '@/components/ui/button';
  6. import { Input } from '@/components/ui/input';
  7. import { Label } from '@/components/ui/label';
  8. import { Spinner } from '@/components/ui/spinner';
  9. import { login, privacy, terms } from '@/routes';
  10. import { store } from '@/routes/register';
  11. type Props = {
  12. passwordRules: string;
  13. };
  14. export default function Register({ passwordRules }: Props) {
  15. return (
  16. <>
  17. <Head title="Register" />
  18. <Form
  19. {...store.form()}
  20. resetOnSuccess={['password', 'password_confirmation']}
  21. disableWhileProcessing
  22. className="flex flex-col gap-6"
  23. >
  24. {({ processing, errors }) => (
  25. <>
  26. <div className="grid gap-6">
  27. <div className="grid gap-2">
  28. <Label htmlFor="name">Name</Label>
  29. <Input
  30. id="name"
  31. type="text"
  32. required
  33. autoFocus
  34. tabIndex={1}
  35. autoComplete="name"
  36. name="name"
  37. placeholder="Full name"
  38. />
  39. <InputError
  40. message={errors.name}
  41. className="mt-2"
  42. />
  43. </div>
  44. <div className="grid gap-2">
  45. <Label htmlFor="email">Email address</Label>
  46. <Input
  47. id="email"
  48. type="email"
  49. required
  50. tabIndex={2}
  51. autoComplete="email"
  52. name="email"
  53. placeholder="email@example.com"
  54. />
  55. <InputError message={errors.email} />
  56. </div>
  57. <div className="grid gap-2">
  58. <Label htmlFor="password">Password</Label>
  59. <PasswordInput
  60. id="password"
  61. required
  62. tabIndex={3}
  63. autoComplete="new-password"
  64. name="password"
  65. placeholder="Password"
  66. passwordrules={passwordRules}
  67. />
  68. <InputError message={errors.password} />
  69. </div>
  70. <div className="grid gap-2">
  71. <Label htmlFor="password_confirmation">
  72. Confirm password
  73. </Label>
  74. <PasswordInput
  75. id="password_confirmation"
  76. required
  77. tabIndex={4}
  78. autoComplete="new-password"
  79. name="password_confirmation"
  80. placeholder="Confirm password"
  81. passwordrules={passwordRules}
  82. />
  83. <InputError
  84. message={errors.password_confirmation}
  85. />
  86. </div>
  87. <Button
  88. type="submit"
  89. className="mt-2 w-full"
  90. tabIndex={5}
  91. data-test="register-user-button"
  92. >
  93. {processing && <Spinner />}
  94. Create account
  95. </Button>
  96. <p className="text-center text-xs text-muted-foreground">
  97. By creating an account, you agree to our{' '}
  98. <TextLink href={terms()} tabIndex={7}>
  99. Terms
  100. </TextLink>{' '}
  101. and{' '}
  102. <TextLink href={privacy()} tabIndex={8}>
  103. Privacy policy
  104. </TextLink>
  105. .
  106. </p>
  107. </div>
  108. <div className="text-center text-sm text-muted-foreground">
  109. Already have an account?{' '}
  110. <TextLink href={login()} tabIndex={6}>
  111. Log in
  112. </TextLink>
  113. </div>
  114. </>
  115. )}
  116. </Form>
  117. </>
  118. );
  119. }
  120. Register.layout = {
  121. title: 'Create an account',
  122. description: 'Enter your details below to create your account',
  123. };