diff --git a/src/app/carga/page.tsx b/src/app/carga/page.tsx new file mode 100644 index 0000000..150bdef --- /dev/null +++ b/src/app/carga/page.tsx @@ -0,0 +1,63 @@ +"use client"; + +import React from "react"; +import FuenteCard from "@/components/fuenteCard"; +import CargaArchivo from "@/components/cargaArchivo"; +import Button from "@/components/button"; + +const fuentes = [ + { nombre: "Fuente 1", fecha: "Martes 3 de mayo 2025", activa: true }, + { nombre: "Fuente 2", fecha: "Martes 3 de mayo 2025", activa: true }, + { nombre: "Fuente 3", fecha: "Martes 3 de mayo 2025", activa: true }, + { nombre: "Fuente 4", fecha: "Martes 3 de mayo 2025", activa: false }, +]; + +export default function Dashboard() { + return ( +
+ + + + +
+ +

Fuentes

+
+ {fuentes.map((f, idx) => ( + + ))} +
+ +

Carga

+
+ +
+
+
+ ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index 21f037a..eba9dd4 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -20,9 +20,9 @@ export default function Login() { }}>
{ + /** + * Variante Bootstrap o personalizada. Ej: `primary`, `danger`, `mi-clase-custom`. + * @default "primary" + */ + variant?: string; + + /** + * Si se usa variante `outline` (por ejemplo, `btn-outline-primary`). + * @default false + */ + outline?: boolean; + + /** + * Ícono Bootstrap (`string`, como `check-circle`) o componente React. + */ + icon?: string | React.ReactNode; + + /** + * Tamaño del botón: `sm` o `lg` para tamaños Bootstrap. + */ + size?: 'sm' | 'lg'; + + /** + * Clases adicionales personalizadas para el botón. + */ + className?: string; +} + +/** + * Componente `Button` con estilos de Bootstrap y soporte para íconos. + */ +const Button: React.FC = ({ + children, + type = 'button', + icon, + className = '', + variant = 'primary', + outline = false, + disabled = false, + size, + ...rest +}) => { + const btnVariant = outline ? `btn-outline-${variant}` : `btn-${variant}`; + const sizeClass = size ? `btn-${size}` : ''; + const combinedClasses = `btn ${btnVariant} ${sizeClass} ${className}`.trim(); + + return ( + + ); +}; + +export default Button; diff --git a/src/components/cargaArchivo.tsx b/src/components/cargaArchivo.tsx new file mode 100644 index 0000000..b07440c --- /dev/null +++ b/src/components/cargaArchivo.tsx @@ -0,0 +1,50 @@ +"use client"; +import React, { useState } from "react"; + +const CargaArchivo: React.FC = () => { + const [archivo, setArchivo] = useState(null); + + const handleChange = (e: React.ChangeEvent) => { + const file = e.target.files?.[0]; + if (file) setArchivo(file); + }; + + const handleUpload = async () => { + if (!archivo) return; + + const formData = new FormData(); + formData.append("archivo", archivo); + + const res = await fetch("/api/cargar-archivo", { + method: "POST", + body: formData, + }); + + if (res.ok) { + alert("Archivo subido correctamente"); + setArchivo(null); + } else { + alert("Error al subir archivo"); + } + }; + + return ( +
+ + +
+ ); +}; + +export default CargaArchivo; diff --git a/src/components/fuenteCard.tsx b/src/components/fuenteCard.tsx new file mode 100644 index 0000000..37b6c0b --- /dev/null +++ b/src/components/fuenteCard.tsx @@ -0,0 +1,26 @@ +type FuenteCardProps = { + nombre: string; + fecha: string; + activa: boolean; +}; + +const FuenteCard: React.FC = ({ nombre, fecha, activa }) => { + return ( +
+
+ {nombre} + +
+

+ Fecha de carga:
+ {fecha} +

+
+ ); +}; + +export default FuenteCard;