revine 0.4.1 → 0.5.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.
package/dist/setup/tailwind.js
CHANGED
|
@@ -127,4 +127,25 @@ export default function HomePage() {
|
|
|
127
127
|
}
|
|
128
128
|
`;
|
|
129
129
|
await fs.writeFile(starterFile, starterFileContent);
|
|
130
|
+
// Replace the NotFound.tsx content
|
|
131
|
+
const notFoundFile = path.join(projectDir, "src", "NotFound.tsx");
|
|
132
|
+
const notFoundContent = `
|
|
133
|
+
export default function NotFound() {
|
|
134
|
+
return (
|
|
135
|
+
<div className="min-h-screen flex items-center justify-center bg-gray-100">
|
|
136
|
+
<div className="text-center space-y-4">
|
|
137
|
+
<h1 className="text-6xl font-bold text-gray-900">404</h1>
|
|
138
|
+
<p className="text-xl text-gray-600">Page Not Found</p>
|
|
139
|
+
<a
|
|
140
|
+
href="/"
|
|
141
|
+
className="mt-6 inline-block bg-indigo-600 text-white font-semibold px-6 py-3 rounded-md shadow hover:bg-indigo-700"
|
|
142
|
+
>
|
|
143
|
+
Go Back Home
|
|
144
|
+
</a>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
`;
|
|
150
|
+
await fs.writeFile(notFoundFile, notFoundContent);
|
|
130
151
|
}
|
package/package.json
CHANGED
package/src/setup/tailwind.ts
CHANGED
|
@@ -138,4 +138,26 @@ export default function HomePage() {
|
|
|
138
138
|
}
|
|
139
139
|
`;
|
|
140
140
|
await fs.writeFile(starterFile, starterFileContent);
|
|
141
|
+
|
|
142
|
+
// Replace the NotFound.tsx content
|
|
143
|
+
const notFoundFile = path.join(projectDir, "src", "NotFound.tsx");
|
|
144
|
+
const notFoundContent = `
|
|
145
|
+
export default function NotFound() {
|
|
146
|
+
return (
|
|
147
|
+
<div className="min-h-screen flex items-center justify-center bg-gray-100">
|
|
148
|
+
<div className="text-center space-y-4">
|
|
149
|
+
<h1 className="text-6xl font-bold text-gray-900">404</h1>
|
|
150
|
+
<p className="text-xl text-gray-600">Page Not Found</p>
|
|
151
|
+
<a
|
|
152
|
+
href="/"
|
|
153
|
+
className="mt-6 inline-block bg-indigo-600 text-white font-semibold px-6 py-3 rounded-md shadow hover:bg-indigo-700"
|
|
154
|
+
>
|
|
155
|
+
Go Back Home
|
|
156
|
+
</a>
|
|
157
|
+
</div>
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
`;
|
|
162
|
+
await fs.writeFile(notFoundFile, notFoundContent);
|
|
141
163
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createBrowserRouter } from "react-router-dom";
|
|
2
2
|
import { lazy, Suspense, ComponentType } from "react";
|
|
3
|
+
import NotFound from "../../src/NotFound";
|
|
3
4
|
|
|
4
5
|
const pages = import.meta.glob("../../src/pages/**/*.tsx");
|
|
5
6
|
|
|
@@ -18,7 +19,6 @@ const routes = Object.entries(pages).map(([filePath, component]) => {
|
|
|
18
19
|
cleaned = "";
|
|
19
20
|
}
|
|
20
21
|
|
|
21
|
-
// 6. Route path is empty for index => "/"
|
|
22
22
|
const routePath = cleaned === "" ? "/" : `/${cleaned}`;
|
|
23
23
|
|
|
24
24
|
const Component = lazy(
|
|
@@ -35,4 +35,10 @@ const routes = Object.entries(pages).map(([filePath, component]) => {
|
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
37
|
|
|
38
|
+
// fallback route for 404s
|
|
39
|
+
routes.push({
|
|
40
|
+
path: "*",
|
|
41
|
+
element: <NotFound />,
|
|
42
|
+
});
|
|
43
|
+
|
|
38
44
|
export const router = createBrowserRouter(routes);
|
package/template/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default function NotFound() {
|
|
2
|
+
return (
|
|
3
|
+
<div className="notfound-container">
|
|
4
|
+
<div className="notfound-content">
|
|
5
|
+
<h1 className="notfound-title">404</h1>
|
|
6
|
+
<p className="notfound-text">Page Not Found</p>
|
|
7
|
+
<a href="/" className="notfound-link">
|
|
8
|
+
Go Back Home
|
|
9
|
+
</a>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
);
|
|
13
|
+
}
|
|
@@ -148,3 +148,44 @@ p {
|
|
|
148
148
|
font-size: 0.875rem;
|
|
149
149
|
color: var(--text-secondary);
|
|
150
150
|
}
|
|
151
|
+
|
|
152
|
+
/* notfound.css */
|
|
153
|
+
.notfound-container {
|
|
154
|
+
min-height: 100vh;
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
justify-content: center;
|
|
158
|
+
background-color: #f5f5f5; /* Light gray */
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.notfound-content {
|
|
162
|
+
text-align: center;
|
|
163
|
+
margin: auto;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.notfound-title {
|
|
167
|
+
font-size: 4rem; /* 64px */
|
|
168
|
+
font-weight: bold;
|
|
169
|
+
color: #1a202c; /* Gray-900 */
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.notfound-text {
|
|
173
|
+
font-size: 1.25rem; /* 20px */
|
|
174
|
+
color: #4a5568; /* Gray-600 */
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.notfound-link {
|
|
178
|
+
margin-top: 1.5rem;
|
|
179
|
+
display: inline-block;
|
|
180
|
+
padding: 0.75rem 1.5rem;
|
|
181
|
+
font-weight: 600;
|
|
182
|
+
background-color: #5a67d8; /* Indigo-600 */
|
|
183
|
+
color: #ffffff;
|
|
184
|
+
text-decoration: none;
|
|
185
|
+
border-radius: 0.375rem;
|
|
186
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.notfound-link:hover {
|
|
190
|
+
background-color: #4c51bf; /* Indigo-700 */
|
|
191
|
+
}
|