feat: Add first login page

This commit is contained in:
2026-01-22 10:21:34 -05:00
parent af198a6ea8
commit 8c53871b4e
4 changed files with 46 additions and 1 deletions

View File

@@ -1,10 +1,11 @@
import './App.css' import './App.css'
import Catalog from './pages/catalog/Catalog' import Catalog from './pages/catalog/Catalog'
import Login from './pages/login/Login'
function App() { function App() {
return ( return (
<> <>
<Login/>
<Catalog/> <Catalog/>
</> </>
) )

View File

@@ -1 +1,2 @@
export * from './catalog/'; export * from './catalog/';
export * from './login/';

42
src/pages/login/Login.tsx Normal file
View File

@@ -0,0 +1,42 @@
import React, { useState } from "react";
const Login = () => {
const [user, setUser] = useState<string>("");
const [password, setPassword] = useState<string>("");
function handleUserChange(e: React.ChangeEvent<HTMLInputElement>): void {
setUser(e.target.value);
}
function handlePasswordChange(e: React.ChangeEvent<HTMLInputElement>): void {
setPassword(e.target.value);
}
function handleSubmit(e: React.FormEvent<HTMLFormElement>): void {
e.preventDefault();
alert([user, password]);
setUser("");
setPassword("");
}
return (
<>
<div>
<h1>Inicia sesión.</h1>
</div>
<div>
<form onSubmit={handleSubmit}>
<img src="https://picsum.photos/300/200?random={i}" alt="Imagen"/><br/>
<label>Usuario:</label><br/>
<input type="text" value={user} onChange={handleUserChange}/><br/>
<label>Contraseña</label><br/>
<input type="password" value={password} onChange={handlePasswordChange}/><br/>
<input type="submit" value="submit"/>
</form>
</div>
</>
)
};
export default Login;

1
src/pages/login/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from './Login.tsx';