From aba498cdf0e6b8d64b6d9042af641e15b9bb8a55 Mon Sep 17 00:00:00 2001 From: SirRobert-1 Date: Sun, 15 Jun 2025 20:31:52 -0600 Subject: [PATCH] feat: enhance Diploma component layout and styling; update course details display --- diplomas/src/components/Diploma.jsx | 163 +++++++++++++++++++--------- 1 file changed, 114 insertions(+), 49 deletions(-) diff --git a/diplomas/src/components/Diploma.jsx b/diplomas/src/components/Diploma.jsx index 7e14251..7865241 100644 --- a/diplomas/src/components/Diploma.jsx +++ b/diplomas/src/components/Diploma.jsx @@ -8,84 +8,149 @@ import { Image, } from "@react-pdf/renderer"; +// Ajusta la ruta de tu logo si es necesario +const LOGO_SRC = "/encabezado.png"; + const styles = StyleSheet.create({ - page: { fontFamily: "Helvetica" }, - title: { fontSize: 24, textAlign: "center", marginBottom: 20 }, - nombre: { + page: { + fontFamily: "Helvetica", + padding: 0, + backgroundColor: "#fff", + position: "relative", + }, + title: { fontSize: 18, textAlign: "center", + marginTop: 40, marginBottom: 10, + fontWeight: "normal", + }, + constancia: { + fontSize: 20, + textAlign: "center", + letterSpacing: 4, + marginBottom: 18, + fontWeight: "normal", + }, + label: { + fontSize: 13, + textAlign: "center", + marginBottom: 6, + fontWeight: "normal", + }, + nombre: { + fontSize: 28, + textAlign: "center", + marginBottom: 16, + fontFamily: "Times-Roman", fontStyle: "italic", }, - curso: { - fontSize: 30, + participacion: { + fontSize: 13, textAlign: "center", - marginBottom: 10, - fontWeight: "bold", + marginBottom: 8, + fontWeight: "normal", }, - section: { padding: 40, fontSize: 14 }, - competencias: { marginLeft: 20, marginTop: 5 }, - competencia: { fontSize: 12, marginBottom: 2 }, - footer: { - position: "absolute", - bottom: 20, - right: 40, + curso: { + fontSize: 15, + textAlign: "center", + fontWeight: "bold", + marginBottom: 6, + }, + detalle: { + fontSize: 11, + textAlign: "center", + marginBottom: 30, + fontWeight: "normal", + }, + nombreDirector: { fontSize: 10, - color: "#888", + textAlign: "center", + marginTop: 40, + marginBottom: 2, + }, + director: { + fontSize: 10, + textAlign: "center", + marginBottom: 18, + }, + footer: { + fontSize: 9, + textAlign: "center", + color: "#444", + position: "absolute", + bottom: 30, + left: 0, + right: 0, }, qr: { - marginTop: 30, - alignSelf: "center", width: 100, height: 100, + alignSelf: "center", + marginTop: 30, }, }); export default function Diploma({ alumno, formacion, fecha, qr }) { - // formacion: { tipo, nombre, competencias } - let tipoTexto = "formación"; - if (formacion?.tipo === "curso") tipoTexto = "curso"; - else if (formacion?.tipo === "inyeccion") tipoTexto = "inyección"; - else if (formacion?.tipo === "pildora") tipoTexto = "píldora educativa"; + // formacion: { tipo, nombre, horas, modalidad } + // Puedes ajustar estos valores según tu modelo de datos + const nombreCurso = + formacion?.nombre || + formacion?.curso?.nombre || + formacion?.inyeccion?.nombre || + formacion?.pildora?.nombre || + "Sin curso"; + const horas = formacion?.horas || 30; + const modalidad = formacion?.modalidad || "remota"; return ( - + {/* Logo */} + + + {/* Título */} Otorga la presente - CONSTANCIA - a: - {alumno?.nombre} - - Por su asistencia{" "} + CONSTANCIA + a: + + {/* Nombre del alumno */} + {alumno?.nombre} + + {/* Participación */} + + Por su participación en el{" "} {formacion?.tipo === "curso" - ? "al curso" + ? "curso" : formacion?.tipo === "inyeccion" - ? "a la inyección" + ? "taller" : formacion?.tipo === "pildora" - ? "a la píldora educativa" - : "a la formación"} + ? "píldora" + : "programa"} - {formacion?.nombre || "Sin formación"} - {(formacion?.tipo === "curso" || formacion?.tipo === "inyeccion") && - formacion?.competencias?.length > 0 && ( - - - Competencias acreditadas: - - {formacion.competencias.map((comp) => ( - - - {comp.descripcion} - - ))} - - )} - - Se expide en la ciudad de Xalapa, Ver., {fecha} + + {/* Nombre del curso/formación */} + “{nombreCurso}” + + {/* Detalle de horas y modalidad */} + + con duración de {horas} horas, modalidad {modalidad}. + + {/* Firma */} + + Dr. Juan Manuel Gutiérrez Méndez + + Director de Proyectos + + {/* QR */} {qr && } + + {/* Footer con fecha */} - Verifica este diploma en: http://localhost:3000/alumno/{alumno?.id} + Se expide en la ciudad de Xalapa, Ver., a los {fecha} + {"\n"} + {/*Verifica este diploma en: http://localhost:3000/alumno/{alumno?.id}*/}