mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Adds a validation schema for the application's environment variables using the Zod library. The parsed environment variables are then exported as constants that can be imported throughout the application, replacing the direct use of process.env.
33 lines
714 B
TypeScript
33 lines
714 B
TypeScript
import { Dispatch, FC, SetStateAction } from 'react';
|
|
import { FiAlertTriangle } from 'react-icons/fi';
|
|
|
|
interface ErrorAlertProps {
|
|
error: string;
|
|
setError: Dispatch<SetStateAction<string>>;
|
|
}
|
|
|
|
const ErrorAlert: FC<ErrorAlertProps> = ({ error, setError }) => {
|
|
return (
|
|
<div className="alert alert-error shadow-lg">
|
|
<div>
|
|
<FiAlertTriangle className="h-6 w-6" />
|
|
<span>{error}</span>
|
|
</div>
|
|
|
|
<div className="flex-none">
|
|
<button
|
|
className="btn-ghost btn-sm btn"
|
|
type="button"
|
|
onClick={() => {
|
|
setError('');
|
|
}}
|
|
>
|
|
OK
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default ErrorAlert;
|