nitro-web 0.0.101 → 0.0.103

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.
@@ -1,12 +1,21 @@
1
1
  import { Topbar, Field, FormError, Button, request, onChange } from 'nitro-web'
2
2
  import { Errors } from 'nitro-web/types'
3
3
 
4
- export function ResetInstructions() {
4
+ type resetInstructionsProps = {
5
+ className?: string,
6
+ elements?: { Button?: typeof Button },
7
+ }
8
+
9
+ export function ResetInstructions({ className, elements }: resetInstructionsProps) {
5
10
  const navigate = useNavigate()
6
11
  const isLoading = useState(false)
7
12
  const [, setStore] = useTracked()
8
13
  const [state, setState] = useState({ email: '', errors: [] as Errors })
9
14
 
15
+ const Elements = {
16
+ Button: elements?.Button || Button,
17
+ }
18
+
10
19
  async function onSubmit (event: React.FormEvent<HTMLFormElement>) {
11
20
  try {
12
21
  await request('post /api/reset-instructions', state, event, isLoading, setState)
@@ -18,10 +27,10 @@ export function ResetInstructions() {
18
27
  }
19
28
 
20
29
  return (
21
- <div class="">
30
+ <div className={className}>
22
31
  <Topbar title={<>Reset your Password</>} />
23
32
 
24
- <form onSubmit={onSubmit}>
33
+ <form onSubmit={onSubmit} class="mb-0">
25
34
  <div>
26
35
  <label for="email">Email Address</label>
27
36
  <Field name="email" type="email" state={state} onChange={(e) => onChange(setState, e)} placeholder="Your email address..." />
@@ -32,13 +41,13 @@ export function ResetInstructions() {
32
41
  <FormError state={state} className="pt-2" />
33
42
  </div>
34
43
 
35
- <Button className="w-full" isLoading={isLoading[0]} type="submit">Email me a reset password link</Button>
44
+ <Elements.Button className="w-full" isLoading={isLoading[0]} type="submit">Email me a reset password link</Elements.Button>
36
45
  </form>
37
46
  </div>
38
47
  )
39
48
  }
40
49
 
41
- export function ResetPassword() {
50
+ export function ResetPassword({ className, elements }: resetInstructionsProps) {
42
51
  const navigate = useNavigate()
43
52
  const params = useParams()
44
53
  const isLoading = useState(false)
@@ -49,6 +58,10 @@ export function ResetPassword() {
49
58
  token: params.token,
50
59
  errors: [] as Errors,
51
60
  }))
61
+
62
+ const Elements = {
63
+ Button: elements?.Button || Button,
64
+ }
52
65
 
53
66
  async function onSubmit (event: React.FormEvent<HTMLFormElement>) {
54
67
  try {
@@ -61,10 +74,10 @@ export function ResetPassword() {
61
74
  }
62
75
 
63
76
  return (
64
- <div class="">
77
+ <div className={className}>
65
78
  <Topbar title={<>Reset your Password</>} />
66
79
 
67
- <form onSubmit={onSubmit}>
80
+ <form onSubmit={onSubmit} class="mb-0">
68
81
  <div>
69
82
  <label for="password">Your New Password</label>
70
83
  <Field name="password" type="password" state={state} onChange={(e) => onChange(setState, e)} />
@@ -79,7 +92,7 @@ export function ResetPassword() {
79
92
  <FormError state={state} className="pt-2" />
80
93
  </div>
81
94
 
82
- <Button class="w-full" isLoading={isLoading[0]} type="submit">Reset Password</Button>
95
+ <Elements.Button class="w-full" isLoading={isLoading[0]} type="submit">Reset Password</Elements.Button>
83
96
  </form>
84
97
  </div>
85
98
  )
@@ -1,7 +1,12 @@
1
1
  import { Topbar, Field, Button, FormError, request, queryObject, injectedConfig, updateJwt, onChange } from 'nitro-web'
2
2
  import { Errors } from 'nitro-web/types'
3
3
 
4
- export function Signin() {
4
+ type signinProps = {
5
+ className?: string,
6
+ elements?: { Button?: typeof Button },
7
+ }
8
+
9
+ export function Signin({ className, elements }: signinProps) {
5
10
  const navigate = useNavigate()
6
11
  const location = useLocation()
7
12
  const isSignout = location.pathname == '/signout'
@@ -12,6 +17,10 @@ export function Signin() {
12
17
  password: injectedConfig.env == 'development' ? '1234' : '',
13
18
  errors: [] as Errors,
14
19
  })
20
+
21
+ const Elements = {
22
+ Button: elements?.Button || Button,
23
+ }
15
24
 
16
25
  useEffect(() => {
17
26
  // Autofill the email input from ?email=
@@ -47,10 +56,10 @@ export function Signin() {
47
56
  }
48
57
 
49
58
  return (
50
- <div>
59
+ <div className={className}>
51
60
  <Topbar title={<>Sign in to your Account</>} />
52
61
 
53
- <form onSubmit={onSubmit}>
62
+ <form onSubmit={onSubmit} class="mb-0">
54
63
  <div>
55
64
  <label for="email">Email Address</label>
56
65
  <Field name="email" type="email" state={state} onChange={(e) => onChange(setState, e)}
@@ -69,7 +78,7 @@ export function Signin() {
69
78
  <FormError state={state} className="pt-2" />
70
79
  </div>
71
80
 
72
- <Button class="w-full" isLoading={isLoading[0]} type="submit">Sign In</Button>
81
+ <Elements.Button class="w-full" isLoading={isLoading[0]} type="submit">Sign In</Elements.Button>
73
82
  </form>
74
83
  </div>
75
84
  )
@@ -1,7 +1,12 @@
1
1
  import { Button, Field, FormError, Topbar, request, injectedConfig, onChange } from 'nitro-web'
2
2
  import { Errors } from 'nitro-web/types'
3
3
 
4
- export function Signup() {
4
+ type signupProps = {
5
+ className?: string,
6
+ elements?: { Button?: typeof Button },
7
+ }
8
+
9
+ export function Signup({ className, elements }: signupProps) {
5
10
  const navigate = useNavigate()
6
11
  const isLoading = useState(false)
7
12
  const [, setStore] = useTracked()
@@ -9,10 +14,14 @@ export function Signup() {
9
14
  email: injectedConfig.env === 'development' ? (injectedConfig.placeholderEmail || '') : '',
10
15
  name: injectedConfig.env === 'development' ? 'Bruce Wayne' : '',
11
16
  business: { name: injectedConfig.env === 'development' ? 'Wayne Enterprises' : '' },
12
- password: injectedConfig.env === 'development' ? '1234' : '',
17
+ password: injectedConfig.env === 'development' ? '' : '',
13
18
  errors: [] as Errors,
14
19
  })
15
20
 
21
+ const Elements = {
22
+ Button: elements?.Button || Button,
23
+ }
24
+
16
25
  async function onSubmit (e: React.FormEvent<HTMLFormElement>) {
17
26
  try {
18
27
  const data = await request('post /api/signup', state, e, isLoading, setState)
@@ -24,10 +33,10 @@ export function Signup() {
24
33
  }
25
34
 
26
35
  return (
27
- <div class="">
36
+ <div className={className}>
28
37
  <Topbar title={<>Start your 21 day Free Trial</>} />
29
38
 
30
- <form onSubmit={onSubmit}>
39
+ <form onSubmit={onSubmit} class="mb-0">
31
40
  <div class="grid grid-cols-2 gap-6">
32
41
  <div>
33
42
  <label for="name">Your Name</label>
@@ -55,7 +64,7 @@ export function Signup() {
55
64
  <FormError state={state} className="pt-2" />
56
65
  </div>
57
66
 
58
- <Button class="w-full" isLoading={isLoading[0]} type="submit">Create Account</Button>
67
+ <Elements.Button class="w-full" isLoading={isLoading[0]} type="submit">Create Account</Elements.Button>
59
68
  </form>
60
69
  </div>
61
70
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nitro-web",
3
- "version": "0.0.101",
3
+ "version": "0.0.103",
4
4
  "repository": "github:boycce/nitro-web",
5
5
  "homepage": "https://boycce.github.io/nitro-web/",
6
6
  "description": "Nitro is a battle-tested, modular base project to turbocharge your projects, styled using Tailwind 🚀",
@@ -7,7 +7,7 @@
7
7
  [[ subject = You've been invited to join IMG ]]
8
8
  <b>%recipient.greet%</b>,<br/>
9
9
  <br/>
10
- You've been invited to join IMG.<br/>
10
+ You've been invited to join <b>%recipient.configName%</b>.<br/>
11
11
  <br/>
12
12
  If you didn't expect to receive this email, feel free to disregard this email.<br/>
13
13
  <br/>