feat: rebuild app using vike

This commit is contained in:
2024-02-22 12:15:04 +00:00
parent 87ef4ca1e3
commit 9777ae1676
104 changed files with 2214 additions and 2976 deletions
+45
View File
@@ -0,0 +1,45 @@
import React from "react";
type ErrorBoundaryProps = {
fallback?: React.ReactNode;
children?: React.ReactNode;
};
type ErrorBoundaryState = {
error?: Error | null;
};
class ErrorBoundary extends React.Component<
ErrorBoundaryProps,
ErrorBoundaryState
> {
constructor(props: ErrorBoundaryProps) {
super(props);
this.state = { error: null };
}
static getDerivedStateFromError(error: unknown) {
return { error };
}
render() {
const { children, fallback } = this.props;
const { error } = this.state;
if (error) {
if (!fallback) {
return (
<div className="p-4 text-sm">
<p>An error occured!</p>
</div>
);
}
return fallback;
}
return children;
}
}
export default ErrorBoundary;