diff --git a/certificate-generator/package-lock.json b/certificate-generator/package-lock.json index b0ee6d4..c28f204 100644 --- a/certificate-generator/package-lock.json +++ b/certificate-generator/package-lock.json @@ -11,7 +11,8 @@ "html2pdf.js": "^0.10.2", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-icons": "^5.2.1" + "react-icons": "^5.2.1", + "react-router-dom": "^6.24.1" }, "devDependencies": { "@types/react": "^18.3.3", @@ -1006,6 +1007,14 @@ "node": ">=14" } }, + "node_modules/@remix-run/router": { + "version": "1.17.1", + "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.17.1.tgz", + "integrity": "sha512-mCOMec4BKd6BRGBZeSnGiIgwsbLGp3yhVqAD8H+PxiRNEHgDpZb8J1TnrSDlg97t0ySKMQJTHCWBCmBpSmkF6Q==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.18.0", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.18.0.tgz", @@ -4378,6 +4387,36 @@ "node": ">=0.10.0" } }, + "node_modules/react-router": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.24.1.tgz", + "integrity": "sha512-PTXFXGK2pyXpHzVo3rR9H7ip4lSPZZc0bHG5CARmj65fTT6qG7sTngmb6lcYu1gf3y/8KxORoy9yn59pGpCnpg==", + "dependencies": { + "@remix-run/router": "1.17.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8" + } + }, + "node_modules/react-router-dom": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.24.1.tgz", + "integrity": "sha512-U19KtXqooqw967Vw0Qcn5cOvrX5Ejo9ORmOtJMzYWtCT4/WOfFLIZGGsVLxcd9UkBO0mSTZtXqhZBsWlHr7+Sg==", + "dependencies": { + "@remix-run/router": "1.17.1", + "react-router": "6.24.1" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "react": ">=16.8", + "react-dom": ">=16.8" + } + }, "node_modules/read-cache": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz", diff --git a/certificate-generator/package.json b/certificate-generator/package.json index 120e123..53a1ef7 100644 --- a/certificate-generator/package.json +++ b/certificate-generator/package.json @@ -13,7 +13,8 @@ "html2pdf.js": "^0.10.2", "react": "^18.3.1", "react-dom": "^18.3.1", - "react-icons": "^5.2.1" + "react-icons": "^5.2.1", + "react-router-dom": "^6.24.1" }, "devDependencies": { "@types/react": "^18.3.3", diff --git a/certificate-generator/src/App.jsx b/certificate-generator/src/App.jsx index aa73b74..40deb2d 100644 --- a/certificate-generator/src/App.jsx +++ b/certificate-generator/src/App.jsx @@ -1,17 +1,27 @@ import React from "react"; import { BrowserRouter as Router, Route, Routes } from "react-router-dom"; +import Navbar from "./Compenents/Navbar"; import Home from "./Home/HomePage"; import CertificateGenerator from "./Compenents/Certificate"; import ContactForm from "./Compenents/Contact"; +import Services from "./Compenents/Service"; +import About from "./Compenents/About"; const App = () => { return ( - - } /> - } /> - } /> - +
+ +
+ + } /> + } /> + } /> + } /> + } /> + +
+
); }; diff --git a/certificate-generator/src/Compenents/About.jsx b/certificate-generator/src/Compenents/About.jsx new file mode 100644 index 0000000..d875759 --- /dev/null +++ b/certificate-generator/src/Compenents/About.jsx @@ -0,0 +1,29 @@ +// About.js + +import React from 'react'; + +const About = () => { + return ( +
+
+

About Us

+

Learn more about our company:

+
+
+

Our Mission

+

+ Description of your company's mission. +

+
+
+

Our Team

+

+ Meet our dedicated team members. +

+
+ {/* Add more about us sections as needed */} +
+ ); +}; + +export default About; diff --git a/certificate-generator/src/Compenents/Certificate.jsx b/certificate-generator/src/Compenents/Certificate.jsx index aec685f..e9d1953 100644 --- a/certificate-generator/src/Compenents/Certificate.jsx +++ b/certificate-generator/src/Compenents/Certificate.jsx @@ -10,123 +10,191 @@ const CertificateGenerator = () => { const [designation, setDesignation] = useState(""); const [certificateGenerated, setCertificateGenerated] = useState(false); - const generateCertificate = () => { - const date = new Date().toLocaleDateString(); - const cinNumber = `CIN: ${generateRandomString(21)}`; - const officeAddress = "1234 Elm Street, Suite 567, City, State, 12345"; - const website = "https://www.example.com"; - const phoneNumber = "+1 (123) 456-7890"; + const generateRandomString = (length) => { + const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; + let result = ""; + for (let i = 0; i < length; i++) { + result += characters.charAt(Math.floor(Math.random() * characters.length)); + } + return result; + }; + const generateCertificate = () => { setCertificateGenerated(true); // Scroll to certificate section setTimeout(() => { - document.getElementById("certificate-section").scrollIntoView({ - behavior: "smooth", - }); + const certificateSection = document.getElementById("certificate-section"); + if (certificateSection) { + certificateSection.scrollIntoView({ behavior: "smooth" }); + } }, 500); }; - const downloadCertificate = () => { + const downloadCertificate = (format) => { const element = document.getElementById("certificate"); - html2pdf() - .set({ - margin: 0, - filename: "Experience_Certificate.pdf", - image: { type: "jpeg", quality: 0.98 }, - html2canvas: { scale: 2, windowWidth: 210 * 2.83, windowHeight: 297 * 2.83 }, - jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, - }) - .from(element) - .save(); + switch (format) { + case "pdf": + html2pdf() + .set({ + margin: 0, + filename: "Experience_Certificate.pdf", + image: { type: "jpeg", quality: 0.98 }, + html2canvas: { scale: 2, windowWidth: 210 * 2.83, windowHeight: 297 * 2.83 }, + jsPDF: { unit: "mm", format: "a4", orientation: "portrait" }, + }) + .from(element) + .save(); + break; + case "doc": + downloadAsDoc(); + break; + case "txt": + downloadAsTxt(); + break; + default: + break; + } }; - const generateRandomString = (length) => { - const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - let result = ""; - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * characters.length)); - } - return result; + const downloadAsDoc = () => { + const content = ` + + Experience Certificate + +

Experience Certificate

+

This is to certify that ${employeeName} has worked as a ${designation} at ${companyName} for a duration of ${duration}.

+

During their tenure, they have demonstrated excellent performance and contributed significantly to the success of our organization.

+

We wish them all the best in their future endeavors.

+

Signature

+

${companyName}

+

1234 Elm Street, Suite 567, City, State, 12345

+

CIN: ${generateRandomString(21)}

+

Website: https://www.example.com

+

Phone: +1 (123) 456-7890

+ + + `; + const blob = new Blob(['\ufeff', content], { type: "application/msword" }); + const link = document.createElement("a"); + link.href = URL.createObjectURL(blob); + link.download = "Experience_Certificate.doc"; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + }; + + const downloadAsTxt = () => { + const textContent = `Experience Certificate\n\n + This is to certify that ${employeeName} has worked as a ${designation} at ${companyName} for a duration of ${duration}.\n + During their tenure, they have demonstrated excellent performance and contributed significantly to the success of our organization.\n + We wish them all the best in their future endeavors.\n + \n + Signature\n + ${companyName} + \n\n + 1234 Elm Street, Suite 567, City, State, 12345 + \n + CIN: ${generateRandomString(21)} + \n + Website: https://www.example.com + \n + Phone: +1 (123) 456-7890 + `; + const blob = new Blob([textContent], { type: "text/plain" }); + const link = document.createElement("a"); + link.href = URL.createObjectURL(blob); + link.download = "Experience_Certificate.txt"; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); }; return ( -

Generate Certificate

-
-
- - setEmployeeName(e.target.value)} - /> -
-
- - setCompanyName(e.target.value)} - /> -
-
- - setDuration(e.target.value)} - /> -
-
- - setDesignation(e.target.value)} - /> -
- -
+
+

Generate Certificate

+
+
+ + setEmployeeName(e.target.value)} + /> +
+
+ + setCompanyName(e.target.value)} + /> +
+
+ + setDuration(e.target.value)} + /> +
+
+ + setDesignation(e.target.value)} + /> +
+ + Generate Certificate + +
+
{certificateGenerated && ( @@ -143,40 +211,14 @@ const CertificateGenerator = () => {

Experience Certificate

-
-

- This is to certify that{" "} - - {employeeName} - {" "} - has worked as a{" "} - - {designation} - {" "} - at{" "} - - {companyName} - {" "} - for a duration of{" "} - - {duration} - - . -

-

- During their tenure, they have demonstrated excellent performance and contributed - significantly to the success of our organization. -

-

We wish them all the best in their future endeavors.

-
-
-

- Signature -

-

- {companyName} -

-
+

+ This is to certify that {employeeName} has worked as a {designation} at {companyName} for a duration of {duration}. + During their tenure, they have demonstrated excellent performance and contributed significantly to the success of our organization. + We wish them all the best in their future endeavors. +

+

+ Signature +

@@ -197,13 +239,32 @@ const CertificateGenerator = () => {

- +
+ downloadCertificate("pdf")} + className="bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700 focus:outline-none focus:bg-blue-700 transition duration-300" + whileHover={{ scale: 1.05 }} + whileTap={{ scale: 0.95 }} + > + Download as PDF + + downloadCertificate("doc")} + className="bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700 focus:outline-none focus:bg-blue-700 transition duration-300" + whileHover={{ scale: 1.05 }} + whileTap={{ scale: 0.95 }} + > + Download as DOC + + downloadCertificate("txt")} + className="bg-blue-600 text-white py-2 px-4 rounded hover:bg-blue-700 focus:outline-none focus:bg-blue-700 transition duration-300" + whileHover={{ scale: 1.05 }} + whileTap={{ scale: 0.95 }} + > + Download as TXT + +
)}
diff --git a/certificate-generator/src/Compenents/Contact.jsx b/certificate-generator/src/Compenents/Contact.jsx index 8ef790d..288ee1e 100644 --- a/certificate-generator/src/Compenents/Contact.jsx +++ b/certificate-generator/src/Compenents/Contact.jsx @@ -43,7 +43,7 @@ const ContactForm = () => { Your Message: