modifiche a Login.tsx e a tsconfig.app.json
This commit is contained in:
parent
168797929c
commit
eadebfa5cd
2 changed files with 65 additions and 17 deletions
|
|
@ -1,6 +1,18 @@
|
||||||
|
import { CircleAlert } from "lucide-react";
|
||||||
import { useState, type FormEvent } from "react";
|
import { useState, type FormEvent } from "react";
|
||||||
import { useNavigate } from "react-router-dom";
|
import { useNavigate } from "react-router-dom";
|
||||||
import { useAuth } from "../context/AuthContext";
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
import {
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
CardDescription,
|
||||||
|
CardHeader,
|
||||||
|
CardTitle,
|
||||||
|
} from "@/components/ui/card";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Label } from "@/components/ui/label";
|
||||||
|
import { useAuth } from "@/context/AuthContext";
|
||||||
|
|
||||||
export default function Login() {
|
export default function Login() {
|
||||||
const { login } = useAuth();
|
const { login } = useAuth();
|
||||||
|
|
@ -25,22 +37,57 @@ export default function Login() {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="auth-page">
|
<div className="flex min-h-svh items-center justify-center bg-muted/40 p-4">
|
||||||
<form className="auth-card" onSubmit={handleSubmit}>
|
<Card className="w-full max-w-md">
|
||||||
<h1>Accedi</h1>
|
<CardHeader>
|
||||||
{error && <p className="error">{error}</p>}
|
<CardTitle className="text-xl">Academy Aziendale</CardTitle>
|
||||||
<label>
|
<CardDescription>
|
||||||
Email
|
Accedi alla piattaforma formativa con le tue credenziali.
|
||||||
<input type="email" value={email} onChange={(e) => setEmail(e.target.value)} required />
|
</CardDescription>
|
||||||
</label>
|
</CardHeader>
|
||||||
<label>
|
<CardContent>
|
||||||
Password
|
<form onSubmit={handleSubmit} className="flex flex-col gap-4">
|
||||||
<input type="password" value={password} onChange={(e) => setPassword(e.target.value)} required />
|
{error && (
|
||||||
</label>
|
<Alert variant="destructive">
|
||||||
<button type="submit" className="btn btn-primary" disabled={loading}>
|
<CircleAlert />
|
||||||
{loading ? "Accesso..." : "Accedi"}
|
<AlertDescription>{error}</AlertDescription>
|
||||||
</button>
|
</Alert>
|
||||||
</form>
|
)}
|
||||||
|
|
||||||
|
<div className="grid gap-2">
|
||||||
|
<Label htmlFor="email">Email</Label>
|
||||||
|
<Input
|
||||||
|
id="email"
|
||||||
|
type="email"
|
||||||
|
autoComplete="email"
|
||||||
|
placeholder="nome@academy.it"
|
||||||
|
value={email}
|
||||||
|
onChange={(e) => setEmail(e.target.value)}
|
||||||
|
required
|
||||||
|
disabled={loading}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="grid gap-2">
|
||||||
|
<Label htmlFor="password">Password</Label>
|
||||||
|
<Input
|
||||||
|
id="password"
|
||||||
|
type="password"
|
||||||
|
autoComplete="current-password"
|
||||||
|
placeholder="••••••••"
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
|
required
|
||||||
|
disabled={loading}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Button type="submit" className="w-full" disabled={loading}>
|
||||||
|
{loading ? "Accesso in corso..." : "Accedi"}
|
||||||
|
</Button>
|
||||||
|
</form>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"jsx": "react-jsx",
|
"jsx": "react-jsx",
|
||||||
|
"ignoreDeprecations": "6.0",
|
||||||
|
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue