nitro-web 0.0.102 → 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
|
-
|
|
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)
|
|
@@ -32,13 +41,13 @@ export function ResetInstructions({ className }: { className?: string }) {
|
|
|
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({ className }:
|
|
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({ className }: { className?: string }) {
|
|
|
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 {
|
|
@@ -79,7 +92,7 @@ export function ResetPassword({ className }: { className?: string }) {
|
|
|
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
|
-
|
|
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({ className }: { className?: string }) {
|
|
|
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=
|
|
@@ -69,7 +78,7 @@ export function Signin({ className }: { className?: string }) {
|
|
|
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
|
-
|
|
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()
|
|
@@ -13,6 +18,10 @@ export function Signup({ className }: { className?: string }) {
|
|
|
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)
|
|
@@ -55,7 +64,7 @@ export function Signup({ className }: { className?: string }) {
|
|
|
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.
|
|
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 🚀",
|