create-react-forge 1.6.0 → 1.6.1
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.
- package/README.md +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +3 -2
- package/dist/cli/parser.js.map +1 -1
- package/dist/config/defaults.d.ts +1 -1
- package/dist/config/defaults.js +2 -2
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/schema.d.ts +11 -9
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +4 -3
- package/dist/config/schema.js.map +1 -1
- package/dist/templates/registry.d.ts +6 -2
- package/dist/templates/registry.d.ts.map +1 -1
- package/dist/templates/registry.js +31 -16
- package/dist/templates/registry.js.map +1 -1
- package/dist/templates/utils.js +4 -4
- package/dist/templates/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/templates/overlays/base/manifest.json +4 -3
- package/src/templates/overlays/base/src/components/ui/Button.tsx +103 -31
- package/src/templates/overlays/base/src/components/ui/Input.tsx +55 -29
- package/src/templates/overlays/base/src/lib/utils.ts +0 -10
- package/src/templates/overlays/runtime/nextjs/src/app/error.tsx +39 -10
- package/src/templates/overlays/runtime/nextjs/src/app/loading.tsx +25 -7
- package/src/templates/overlays/runtime/nextjs/src/app/not-found.tsx +54 -13
- package/src/templates/overlays/runtime/nextjs/src/app/page.tsx +55 -13
- package/src/templates/overlays/runtime/nextjs/src/styles/globals.css +1 -1
- package/src/templates/overlays/runtime/vite/src/components/errors/ErrorFallback.tsx +49 -15
- package/src/templates/overlays/runtime/vite/src/components/ui/LoadingSpinner.tsx +33 -13
- package/src/templates/overlays/runtime/vite/src/features/misc/routes/Landing.tsx +78 -21
- package/src/templates/overlays/runtime/vite/src/features/misc/routes/NotFound.tsx +77 -19
- package/src/templates/overlays/runtime/vite/src/main.tsx +0 -2
- package/src/templates/overlays/styling/css/_nextjs/src/app/error.css +49 -0
- package/src/templates/overlays/styling/css/_nextjs/src/app/error.tsx +34 -0
- package/src/templates/overlays/styling/css/_nextjs/src/app/loading.css +28 -0
- package/src/templates/overlays/styling/css/_nextjs/src/app/loading.tsx +13 -0
- package/src/templates/overlays/styling/css/_nextjs/src/app/not-found.css +70 -0
- package/src/templates/overlays/styling/css/_nextjs/src/app/not-found.tsx +25 -0
- package/src/templates/overlays/styling/css/_nextjs/src/app/page.css +73 -0
- package/src/templates/overlays/styling/css/_nextjs/src/app/page.tsx +32 -0
- package/src/templates/overlays/styling/css/_vite/src/components/errors/ErrorFallback.css +49 -0
- package/src/templates/overlays/styling/css/_vite/src/components/errors/ErrorFallback.tsx +22 -0
- package/src/templates/overlays/styling/css/_vite/src/components/ui/LoadingSpinner.css +40 -0
- package/src/templates/overlays/styling/css/_vite/src/components/ui/LoadingSpinner.tsx +21 -0
- package/src/templates/overlays/styling/css/_vite/src/features/misc/routes/Landing.css +73 -0
- package/src/templates/overlays/styling/css/_vite/src/features/misc/routes/Landing.tsx +32 -0
- package/src/templates/overlays/styling/css/_vite/src/features/misc/routes/NotFound.css +70 -0
- package/src/templates/overlays/styling/css/_vite/src/features/misc/routes/NotFound.tsx +25 -0
- package/src/templates/overlays/styling/css/manifest.json +17 -0
- package/src/templates/overlays/styling/css/src/styles/globals.css +107 -0
- package/src/templates/overlays/styling/css-modules/_nextjs/src/app/loading.tsx +13 -0
- package/src/templates/overlays/styling/css-modules/_nextjs/src/app/page.module.css +73 -0
- package/src/templates/overlays/styling/css-modules/_nextjs/src/app/page.tsx +32 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/components/errors/ErrorFallback.module.css +45 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/components/errors/ErrorFallback.tsx +22 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/components/ui/LoadingSpinner.module.css +40 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/components/ui/LoadingSpinner.tsx +23 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/features/misc/routes/Landing.module.css +73 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/features/misc/routes/Landing.tsx +32 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/features/misc/routes/NotFound.module.css +67 -0
- package/src/templates/overlays/styling/css-modules/_vite/src/features/misc/routes/NotFound.tsx +25 -0
- package/src/templates/overlays/styling/css-modules/manifest.json +6 -3
- package/src/templates/overlays/styling/css-modules/src/css.d.ts +13 -0
- package/src/templates/overlays/styling/styled-components/_nextjs/src/app/error.tsx +72 -0
- package/src/templates/overlays/styling/styled-components/_nextjs/src/app/layout.tsx +25 -0
- package/src/templates/overlays/styling/styled-components/_nextjs/src/app/loading.tsx +40 -0
- package/src/templates/overlays/styling/styled-components/_nextjs/src/app/not-found.tsx +91 -0
- package/src/templates/overlays/styling/styled-components/_nextjs/src/app/page.tsx +102 -0
- package/src/templates/overlays/styling/styled-components/_nextjs/src/app/providers.tsx +22 -0
- package/src/templates/overlays/styling/styled-components/{src → _nextjs/src}/lib/StyledComponentsRegistry.tsx +10 -2
- package/src/templates/overlays/styling/styled-components/_vite/src/app/provider.tsx +27 -0
- package/src/templates/overlays/styling/styled-components/_vite/src/components/errors/ErrorFallback.tsx +59 -0
- package/src/templates/overlays/styling/styled-components/_vite/src/components/ui/LoadingSpinner.tsx +47 -0
- package/src/templates/overlays/styling/styled-components/_vite/src/features/misc/routes/Landing.tsx +100 -0
- package/src/templates/overlays/styling/styled-components/_vite/src/features/misc/routes/NotFound.tsx +89 -0
- package/src/templates/overlays/styling/styled-components/_vite/src/main.tsx +13 -0
- package/src/templates/overlays/styling/styled-components/manifest.json +5 -1
- package/src/templates/overlays/styling/tailwind/_nextjs/src/app/error.tsx +33 -0
- package/src/templates/overlays/styling/tailwind/_nextjs/src/app/loading.tsx +12 -0
- package/src/templates/overlays/styling/tailwind/_nextjs/src/app/not-found.tsx +26 -0
- package/src/templates/overlays/styling/tailwind/_nextjs/src/app/page.tsx +33 -0
- package/src/templates/overlays/styling/tailwind/manifest.json +5 -3
- package/src/templates/overlays/runtime/vite/src/styles/globals.css +0 -55
- package/src/templates/overlays/styling/css-modules/src/components/ui/Button.module.css +0 -87
- package/src/templates/overlays/styling/css-modules/src/styles/globals.css +0 -91
|
@@ -1,51 +1,77 @@
|
|
|
1
1
|
import { forwardRef } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
export type InputProps = React.InputHTMLAttributes<HTMLInputElement> & {
|
|
5
5
|
label?: string;
|
|
6
6
|
error?: string;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
const InputWrapper = styled.div`
|
|
10
|
+
width: 100%;
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
const Label = styled.label`
|
|
14
|
+
display: block;
|
|
15
|
+
margin-bottom: 0.25rem;
|
|
16
|
+
font-size: 0.875rem;
|
|
17
|
+
font-weight: 500;
|
|
18
|
+
color: #374151;
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
const StyledInput = styled.input<{ $hasError?: boolean }>`
|
|
22
|
+
display: block;
|
|
23
|
+
width: 100%;
|
|
24
|
+
padding: 0.5rem 0.75rem;
|
|
25
|
+
font-size: 1rem;
|
|
26
|
+
color: #111827;
|
|
27
|
+
background-color: white;
|
|
28
|
+
border: 1px solid ${(props) => (props.$hasError ? '#fca5a5' : '#d1d5db')};
|
|
29
|
+
border-radius: 0.375rem;
|
|
30
|
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
31
|
+
transition: border-color 0.2s, box-shadow 0.2s;
|
|
32
|
+
|
|
33
|
+
&::placeholder {
|
|
34
|
+
color: #9ca3af;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:focus {
|
|
38
|
+
outline: none;
|
|
39
|
+
border-color: ${(props) => (props.$hasError ? '#ef4444' : '#4f46e5')};
|
|
40
|
+
box-shadow: 0 0 0 2px ${(props) => (props.$hasError ? '#fecaca' : '#c7d2fe')};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&:disabled {
|
|
44
|
+
cursor: not-allowed;
|
|
45
|
+
background-color: #f9fafb;
|
|
46
|
+
color: #6b7280;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
const ErrorMessage = styled.p`
|
|
51
|
+
margin-top: 0.25rem;
|
|
52
|
+
font-size: 0.875rem;
|
|
53
|
+
color: #dc2626;
|
|
54
|
+
`;
|
|
55
|
+
|
|
9
56
|
export const Input = forwardRef<HTMLInputElement, InputProps>(
|
|
10
|
-
({
|
|
57
|
+
({ label, error, id, ...props }, ref) => {
|
|
11
58
|
const inputId = id || props.name;
|
|
12
59
|
|
|
13
60
|
return (
|
|
14
|
-
<
|
|
15
|
-
{label &&
|
|
16
|
-
|
|
17
|
-
htmlFor={inputId}
|
|
18
|
-
className="mb-1 block text-sm font-medium text-gray-700"
|
|
19
|
-
>
|
|
20
|
-
{label}
|
|
21
|
-
</label>
|
|
22
|
-
)}
|
|
23
|
-
<input
|
|
61
|
+
<InputWrapper>
|
|
62
|
+
{label && <Label htmlFor={inputId}>{label}</Label>}
|
|
63
|
+
<StyledInput
|
|
24
64
|
ref={ref}
|
|
25
65
|
id={inputId}
|
|
26
|
-
|
|
27
|
-
'block w-full rounded-md border-0 px-3 py-2 text-gray-900 shadow-sm ring-1 ring-inset',
|
|
28
|
-
'placeholder:text-gray-400',
|
|
29
|
-
'focus:ring-2 focus:ring-inset focus:ring-indigo-600',
|
|
30
|
-
'disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500',
|
|
31
|
-
error
|
|
32
|
-
? 'ring-red-300 focus:ring-red-500'
|
|
33
|
-
: 'ring-gray-300',
|
|
34
|
-
className
|
|
35
|
-
)}
|
|
66
|
+
$hasError={!!error}
|
|
36
67
|
aria-invalid={error ? 'true' : 'false'}
|
|
37
68
|
aria-describedby={error ? `${inputId}-error` : undefined}
|
|
38
69
|
{...props}
|
|
39
70
|
/>
|
|
40
|
-
{error &&
|
|
41
|
-
|
|
42
|
-
{error}
|
|
43
|
-
</p>
|
|
44
|
-
)}
|
|
45
|
-
</div>
|
|
71
|
+
{error && <ErrorMessage id={`${inputId}-error`}>{error}</ErrorMessage>}
|
|
72
|
+
</InputWrapper>
|
|
46
73
|
);
|
|
47
74
|
}
|
|
48
75
|
);
|
|
49
76
|
|
|
50
77
|
Input.displayName = 'Input';
|
|
51
|
-
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import { clsx, type ClassValue } from 'clsx';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Utility function for constructing className strings conditionally
|
|
5
|
-
*/
|
|
6
|
-
export function cn(...inputs: ClassValue[]) {
|
|
7
|
-
return clsx(inputs);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
1
|
/**
|
|
11
2
|
* Format a date to a human-readable string
|
|
12
3
|
*/
|
|
@@ -31,4 +22,3 @@ export function sleep(ms: number): Promise<void> {
|
|
|
31
22
|
export function generateId(): string {
|
|
32
23
|
return Math.random().toString(36).substring(2, 9);
|
|
33
24
|
}
|
|
34
|
-
|
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
|
|
5
|
+
const styles = {
|
|
6
|
+
container: {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
minHeight: '100vh',
|
|
9
|
+
flexDirection: 'column' as const,
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
},
|
|
13
|
+
content: {
|
|
14
|
+
textAlign: 'center' as const,
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
fontSize: '1.5rem',
|
|
18
|
+
fontWeight: 700,
|
|
19
|
+
color: '#dc2626',
|
|
20
|
+
},
|
|
21
|
+
message: {
|
|
22
|
+
marginTop: '1rem',
|
|
23
|
+
color: '#4b5563',
|
|
24
|
+
},
|
|
25
|
+
retryButton: {
|
|
26
|
+
marginTop: '1.5rem',
|
|
27
|
+
padding: '0.625rem 0.875rem',
|
|
28
|
+
fontSize: '0.875rem',
|
|
29
|
+
fontWeight: 600,
|
|
30
|
+
color: 'white',
|
|
31
|
+
backgroundColor: '#4f46e5',
|
|
32
|
+
border: 'none',
|
|
33
|
+
borderRadius: '0.375rem',
|
|
34
|
+
boxShadow: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
|
|
5
39
|
export default function Error({
|
|
6
40
|
error,
|
|
7
41
|
reset,
|
|
@@ -10,25 +44,20 @@ export default function Error({
|
|
|
10
44
|
reset: () => void;
|
|
11
45
|
}) {
|
|
12
46
|
useEffect(() => {
|
|
13
|
-
// Log the error to an error reporting service
|
|
14
47
|
console.error(error);
|
|
15
48
|
}, [error]);
|
|
16
49
|
|
|
17
50
|
return (
|
|
18
|
-
<div
|
|
19
|
-
<div
|
|
20
|
-
<h1
|
|
21
|
-
<p
|
|
51
|
+
<div style={styles.container} role="alert">
|
|
52
|
+
<div style={styles.content}>
|
|
53
|
+
<h1 style={styles.title}>Something went wrong</h1>
|
|
54
|
+
<p style={styles.message}>
|
|
22
55
|
{error.message || 'An unexpected error occurred'}
|
|
23
56
|
</p>
|
|
24
|
-
<button
|
|
25
|
-
onClick={reset}
|
|
26
|
-
className="mt-6 rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500"
|
|
27
|
-
>
|
|
57
|
+
<button onClick={reset} style={styles.retryButton}>
|
|
28
58
|
Try again
|
|
29
59
|
</button>
|
|
30
60
|
</div>
|
|
31
61
|
</div>
|
|
32
62
|
);
|
|
33
63
|
}
|
|
34
|
-
|
|
@@ -1,12 +1,30 @@
|
|
|
1
|
+
const styles = {
|
|
2
|
+
container: {
|
|
3
|
+
display: 'flex',
|
|
4
|
+
minHeight: '100vh',
|
|
5
|
+
alignItems: 'center',
|
|
6
|
+
justifyContent: 'center',
|
|
7
|
+
},
|
|
8
|
+
spinner: {
|
|
9
|
+
width: '2rem',
|
|
10
|
+
height: '2rem',
|
|
11
|
+
border: '2px solid #d1d5db',
|
|
12
|
+
borderTopColor: '#4f46e5',
|
|
13
|
+
borderRadius: '50%',
|
|
14
|
+
animation: 'spin 1s linear infinite',
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
1
18
|
export default function Loading() {
|
|
2
19
|
return (
|
|
3
|
-
<div
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
20
|
+
<div style={styles.container}>
|
|
21
|
+
<style>{`
|
|
22
|
+
@keyframes spin {
|
|
23
|
+
from { transform: rotate(0deg); }
|
|
24
|
+
to { transform: rotate(360deg); }
|
|
25
|
+
}
|
|
26
|
+
`}</style>
|
|
27
|
+
<div style={styles.spinner} role="status" aria-label="Loading" />
|
|
9
28
|
</div>
|
|
10
29
|
);
|
|
11
30
|
}
|
|
12
|
-
|
|
@@ -1,21 +1,63 @@
|
|
|
1
1
|
import Link from 'next/link';
|
|
2
2
|
|
|
3
|
+
const styles = {
|
|
4
|
+
container: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
minHeight: '100vh',
|
|
7
|
+
flexDirection: 'column' as const,
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
justifyContent: 'center',
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
textAlign: 'center' as const,
|
|
13
|
+
},
|
|
14
|
+
errorCode: {
|
|
15
|
+
fontSize: '1rem',
|
|
16
|
+
fontWeight: 600,
|
|
17
|
+
color: '#4f46e5',
|
|
18
|
+
},
|
|
19
|
+
title: {
|
|
20
|
+
marginTop: '1rem',
|
|
21
|
+
fontSize: '1.875rem',
|
|
22
|
+
fontWeight: 700,
|
|
23
|
+
letterSpacing: '-0.025em',
|
|
24
|
+
},
|
|
25
|
+
description: {
|
|
26
|
+
marginTop: '1.5rem',
|
|
27
|
+
fontSize: '1rem',
|
|
28
|
+
lineHeight: '1.75rem',
|
|
29
|
+
color: '#4b5563',
|
|
30
|
+
},
|
|
31
|
+
actions: {
|
|
32
|
+
marginTop: '2.5rem',
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
justifyContent: 'center',
|
|
36
|
+
gap: '1.5rem',
|
|
37
|
+
},
|
|
38
|
+
homeLink: {
|
|
39
|
+
padding: '0.625rem 0.875rem',
|
|
40
|
+
fontSize: '0.875rem',
|
|
41
|
+
fontWeight: 600,
|
|
42
|
+
color: 'white',
|
|
43
|
+
backgroundColor: '#4f46e5',
|
|
44
|
+
borderRadius: '0.375rem',
|
|
45
|
+
textDecoration: 'none',
|
|
46
|
+
boxShadow: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
3
50
|
export default function NotFound() {
|
|
4
51
|
return (
|
|
5
|
-
<div
|
|
6
|
-
<div
|
|
7
|
-
<p
|
|
8
|
-
<h1
|
|
9
|
-
|
|
10
|
-
</h1>
|
|
11
|
-
<p className="mt-6 text-base leading-7 text-gray-600">
|
|
52
|
+
<div style={styles.container}>
|
|
53
|
+
<div style={styles.content}>
|
|
54
|
+
<p style={styles.errorCode}>404</p>
|
|
55
|
+
<h1 style={styles.title}>Page not found</h1>
|
|
56
|
+
<p style={styles.description}>
|
|
12
57
|
Sorry, we couldn't find the page you're looking for.
|
|
13
58
|
</p>
|
|
14
|
-
<div
|
|
15
|
-
<Link
|
|
16
|
-
href="/"
|
|
17
|
-
className="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
|
18
|
-
>
|
|
59
|
+
<div style={styles.actions}>
|
|
60
|
+
<Link href="/" style={styles.homeLink}>
|
|
19
61
|
Go back home
|
|
20
62
|
</Link>
|
|
21
63
|
</div>
|
|
@@ -23,4 +65,3 @@ export default function NotFound() {
|
|
|
23
65
|
</div>
|
|
24
66
|
);
|
|
25
67
|
}
|
|
26
|
-
|
|
@@ -1,25 +1,68 @@
|
|
|
1
1
|
import Link from 'next/link';
|
|
2
2
|
|
|
3
|
+
const styles = {
|
|
4
|
+
container: {
|
|
5
|
+
display: 'flex',
|
|
6
|
+
minHeight: '100vh',
|
|
7
|
+
flexDirection: 'column' as const,
|
|
8
|
+
alignItems: 'center',
|
|
9
|
+
justifyContent: 'center',
|
|
10
|
+
},
|
|
11
|
+
content: {
|
|
12
|
+
textAlign: 'center' as const,
|
|
13
|
+
},
|
|
14
|
+
title: {
|
|
15
|
+
fontSize: '2.25rem',
|
|
16
|
+
fontWeight: 700,
|
|
17
|
+
letterSpacing: '-0.025em',
|
|
18
|
+
},
|
|
19
|
+
description: {
|
|
20
|
+
marginTop: '1.5rem',
|
|
21
|
+
fontSize: '1.125rem',
|
|
22
|
+
lineHeight: '2rem',
|
|
23
|
+
color: '#4b5563',
|
|
24
|
+
},
|
|
25
|
+
actions: {
|
|
26
|
+
marginTop: '2.5rem',
|
|
27
|
+
display: 'flex',
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
justifyContent: 'center',
|
|
30
|
+
gap: '1.5rem',
|
|
31
|
+
},
|
|
32
|
+
primaryLink: {
|
|
33
|
+
padding: '0.625rem 0.875rem',
|
|
34
|
+
fontSize: '0.875rem',
|
|
35
|
+
fontWeight: 600,
|
|
36
|
+
color: 'white',
|
|
37
|
+
backgroundColor: '#4f46e5',
|
|
38
|
+
borderRadius: '0.375rem',
|
|
39
|
+
textDecoration: 'none',
|
|
40
|
+
boxShadow: '0 1px 2px 0 rgb(0 0 0 / 0.05)',
|
|
41
|
+
},
|
|
42
|
+
secondaryLink: {
|
|
43
|
+
fontSize: '0.875rem',
|
|
44
|
+
fontWeight: 600,
|
|
45
|
+
lineHeight: '1.5rem',
|
|
46
|
+
color: 'inherit',
|
|
47
|
+
textDecoration: 'none',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
3
51
|
export default function HomePage() {
|
|
4
52
|
return (
|
|
5
|
-
<div
|
|
6
|
-
<div
|
|
7
|
-
<h1
|
|
8
|
-
|
|
9
|
-
</h1>
|
|
10
|
-
<p className="mt-6 text-lg leading-8 text-gray-600">
|
|
53
|
+
<div style={styles.container}>
|
|
54
|
+
<div style={styles.content}>
|
|
55
|
+
<h1 style={styles.title}>Welcome to Your App</h1>
|
|
56
|
+
<p style={styles.description}>
|
|
11
57
|
A production-ready Next.js application scaffolded with create-react-forge.
|
|
12
58
|
</p>
|
|
13
|
-
<div
|
|
14
|
-
<Link
|
|
15
|
-
href="/dashboard"
|
|
16
|
-
className="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
|
17
|
-
>
|
|
59
|
+
<div style={styles.actions}>
|
|
60
|
+
<Link href="/dashboard" style={styles.primaryLink}>
|
|
18
61
|
Get started
|
|
19
62
|
</Link>
|
|
20
63
|
<a
|
|
21
64
|
href="https://github.com/alan2207/bulletproof-react"
|
|
22
|
-
|
|
65
|
+
style={styles.secondaryLink}
|
|
23
66
|
target="_blank"
|
|
24
67
|
rel="noopener noreferrer"
|
|
25
68
|
>
|
|
@@ -30,4 +73,3 @@ export default function HomePage() {
|
|
|
30
73
|
</div>
|
|
31
74
|
);
|
|
32
75
|
}
|
|
33
|
-
|
|
@@ -1,21 +1,55 @@
|
|
|
1
1
|
import { FallbackProps } from 'react-error-boundary';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
min-height: 100vh;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const Content = styled.div`
|
|
13
|
+
text-align: center;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const Title = styled.h1`
|
|
17
|
+
font-size: 1.5rem;
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
color: #dc2626;
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
const Message = styled.p`
|
|
23
|
+
margin-top: 1rem;
|
|
24
|
+
color: #4b5563;
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
const RetryButton = styled.button`
|
|
28
|
+
margin-top: 1.5rem;
|
|
29
|
+
padding: 0.625rem 0.875rem;
|
|
30
|
+
font-size: 0.875rem;
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
color: white;
|
|
33
|
+
background-color: #4f46e5;
|
|
34
|
+
border: none;
|
|
35
|
+
border-radius: 0.375rem;
|
|
36
|
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
transition: background-color 0.2s;
|
|
39
|
+
|
|
40
|
+
&:hover {
|
|
41
|
+
background-color: #6366f1;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
2
44
|
|
|
3
45
|
export function ErrorFallback({ error, resetErrorBoundary }: FallbackProps) {
|
|
4
46
|
return (
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
onClick={resetErrorBoundary}
|
|
13
|
-
className="mt-6 rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500"
|
|
14
|
-
>
|
|
15
|
-
Try again
|
|
16
|
-
</button>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
47
|
+
<Container role="alert">
|
|
48
|
+
<Content>
|
|
49
|
+
<Title>Something went wrong</Title>
|
|
50
|
+
<Message>{error.message || 'An unexpected error occurred'}</Message>
|
|
51
|
+
<RetryButton onClick={resetErrorBoundary}>Try again</RetryButton>
|
|
52
|
+
</Content>
|
|
53
|
+
</Container>
|
|
19
54
|
);
|
|
20
55
|
}
|
|
21
|
-
|
|
@@ -1,23 +1,43 @@
|
|
|
1
|
+
import styled, { keyframes } from 'styled-components';
|
|
2
|
+
|
|
1
3
|
type LoadingSpinnerProps = {
|
|
2
4
|
size?: 'sm' | 'md' | 'lg';
|
|
3
|
-
className?: string;
|
|
4
5
|
};
|
|
5
6
|
|
|
7
|
+
const spin = keyframes`
|
|
8
|
+
from {
|
|
9
|
+
transform: rotate(0deg);
|
|
10
|
+
}
|
|
11
|
+
to {
|
|
12
|
+
transform: rotate(360deg);
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
|
|
6
16
|
const sizes = {
|
|
7
|
-
sm: '
|
|
8
|
-
md: '
|
|
9
|
-
lg: '
|
|
17
|
+
sm: '1rem',
|
|
18
|
+
md: '2rem',
|
|
19
|
+
lg: '4rem',
|
|
10
20
|
};
|
|
11
21
|
|
|
12
|
-
|
|
22
|
+
const SpinnerContainer = styled.div`
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const Spinner = styled.div<{ $size: 'sm' | 'md' | 'lg' }>`
|
|
29
|
+
width: ${(props) => sizes[props.$size]};
|
|
30
|
+
height: ${(props) => sizes[props.$size]};
|
|
31
|
+
border: 2px solid #d1d5db;
|
|
32
|
+
border-top-color: #4f46e5;
|
|
33
|
+
border-radius: 50%;
|
|
34
|
+
animation: ${spin} 1s linear infinite;
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
export function LoadingSpinner({ size = 'md' }: LoadingSpinnerProps) {
|
|
13
38
|
return (
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
role="status"
|
|
18
|
-
aria-label="Loading"
|
|
19
|
-
/>
|
|
20
|
-
</div>
|
|
39
|
+
<SpinnerContainer>
|
|
40
|
+
<Spinner $size={size} role="status" aria-label="Loading" />
|
|
41
|
+
</SpinnerContainer>
|
|
21
42
|
);
|
|
22
43
|
}
|
|
23
|
-
|
|
@@ -1,33 +1,90 @@
|
|
|
1
1
|
import { Link } from 'react-router-dom';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
const Container = styled.div`
|
|
5
|
+
display: flex;
|
|
6
|
+
min-height: 100vh;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
const Content = styled.div`
|
|
13
|
+
text-align: center;
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
const Title = styled.h1`
|
|
17
|
+
font-size: 2.25rem;
|
|
18
|
+
font-weight: 700;
|
|
19
|
+
letter-spacing: -0.025em;
|
|
20
|
+
|
|
21
|
+
@media (min-width: 640px) {
|
|
22
|
+
font-size: 3.75rem;
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const Description = styled.p`
|
|
27
|
+
margin-top: 1.5rem;
|
|
28
|
+
font-size: 1.125rem;
|
|
29
|
+
line-height: 2rem;
|
|
30
|
+
color: #4b5563;
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
const Actions = styled.div`
|
|
34
|
+
margin-top: 2.5rem;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
gap: 1.5rem;
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const PrimaryLink = styled(Link)`
|
|
42
|
+
padding: 0.625rem 0.875rem;
|
|
43
|
+
font-size: 0.875rem;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
color: white;
|
|
46
|
+
background-color: #4f46e5;
|
|
47
|
+
border-radius: 0.375rem;
|
|
48
|
+
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
|
|
49
|
+
text-decoration: none;
|
|
50
|
+
transition: background-color 0.2s;
|
|
51
|
+
|
|
52
|
+
&:hover {
|
|
53
|
+
background-color: #6366f1;
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
const SecondaryLink = styled.a`
|
|
58
|
+
font-size: 0.875rem;
|
|
59
|
+
font-weight: 600;
|
|
60
|
+
line-height: 1.5rem;
|
|
61
|
+
color: inherit;
|
|
62
|
+
text-decoration: none;
|
|
63
|
+
|
|
64
|
+
&:hover {
|
|
65
|
+
text-decoration: underline;
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
2
68
|
|
|
3
69
|
export function Landing() {
|
|
4
70
|
return (
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
<
|
|
8
|
-
|
|
9
|
-
</h1>
|
|
10
|
-
<p className="mt-6 text-lg leading-8 text-gray-600">
|
|
71
|
+
<Container>
|
|
72
|
+
<Content>
|
|
73
|
+
<Title>Welcome to Your App</Title>
|
|
74
|
+
<Description>
|
|
11
75
|
A production-ready React application scaffolded with create-react-forge.
|
|
12
|
-
</
|
|
13
|
-
<
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
className="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
|
17
|
-
>
|
|
18
|
-
Get started
|
|
19
|
-
</Link>
|
|
20
|
-
<a
|
|
76
|
+
</Description>
|
|
77
|
+
<Actions>
|
|
78
|
+
<PrimaryLink to="/dashboard">Get started</PrimaryLink>
|
|
79
|
+
<SecondaryLink
|
|
21
80
|
href="https://github.com/alan2207/bulletproof-react"
|
|
22
|
-
className="text-sm font-semibold leading-6"
|
|
23
81
|
target="_blank"
|
|
24
82
|
rel="noopener noreferrer"
|
|
25
83
|
>
|
|
26
84
|
Learn more <span aria-hidden="true">→</span>
|
|
27
|
-
</
|
|
28
|
-
</
|
|
29
|
-
</
|
|
30
|
-
</
|
|
85
|
+
</SecondaryLink>
|
|
86
|
+
</Actions>
|
|
87
|
+
</Content>
|
|
88
|
+
</Container>
|
|
31
89
|
);
|
|
32
90
|
}
|
|
33
|
-
|