diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/.eslintrc.cjs b/React-JS-Projects/Advanced/Qr-Code-Generator/.eslintrc.cjs new file mode 100644 index 00000000..3e212e1d --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/.eslintrc.cjs @@ -0,0 +1,21 @@ +module.exports = { + root: true, + env: { browser: true, es2020: true }, + extends: [ + 'eslint:recommended', + 'plugin:react/recommended', + 'plugin:react/jsx-runtime', + 'plugin:react-hooks/recommended', + ], + ignorePatterns: ['dist', '.eslintrc.cjs'], + parserOptions: { ecmaVersion: 'latest', sourceType: 'module' }, + settings: { react: { version: '18.2' } }, + plugins: ['react-refresh'], + rules: { + 'react/jsx-no-target-blank': 'off', + 'react-refresh/only-export-components': [ + 'warn', + { allowConstantExport: true }, + ], + }, +} diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/README.md b/React-JS-Projects/Advanced/Qr-Code-Generator/README.md new file mode 100644 index 00000000..44028301 --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/README.md @@ -0,0 +1,69 @@ +

đŸ’Ĩ QR CODE GENERATOR đŸ’Ĩ

+ + + +

Tech Stack Used 🎮

+ + +
+ + ![HTML5](https://img.shields.io/badge/html5-%23E34F26.svg?style=for-the-badge&logo=html5&logoColor=white) + ![CSS3](https://img.shields.io/badge/css3-%231572B6.svg?style=for-the-badge&logo=css3&logoColor=white) + ![JavaScript](https://img.shields.io/badge/javascript-%23323330.svg?style=for-the-badge&logo=javascript&logoColor=%23F7DF1E) + ![React](https://img.shields.io/badge/react-%2320232a.svg?style=for-the-badge&logo=react&logoColor=%2361DAFB) +
+ + +![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847) + + + +## :zap: Description 📃 + +
+ +

This project is a react.js project that generates QR code which can be downloaded when an URL of a website is entered.

+
+ + + + +## :zap: How to run it? 🕹ī¸ + + +To run this project locally, follow these steps: + +1. Fork the repository. + +2. Clone the repository to your local computer: + git clone https://github.com/your-username/Qr-Code-Generator-Clone.git + +3. Open the project folder in your preferred code editor, now you can view website in live. + + + + + +## :zap: Screenshots 📸 + + + + + +![Line](https://github.com/Avdhesh-Varshney/WebMasterLog/assets/114330097/4b78510f-a941-45f8-a9d5-80ed0705e847) + + + +

Developed By Sai Manjari 👧

+

+ + + + + + +

+ +

Happy Coding 🧑‍đŸ’ģ

+ +

Show some  â¤ī¸  by  đŸŒŸ  this repository!

\ No newline at end of file diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/index.html b/React-JS-Projects/Advanced/Qr-Code-Generator/index.html new file mode 100644 index 00000000..0c589ecc --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/index.html @@ -0,0 +1,13 @@ + + + + + + + Vite + React + + +
+ + + diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/package.json b/React-JS-Projects/Advanced/Qr-Code-Generator/package.json new file mode 100644 index 00000000..137c6ab4 --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/package.json @@ -0,0 +1,26 @@ +{ + "name": "qr-code-generator", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "lint": "eslint . --ext js,jsx --report-unused-disable-directives --max-warnings 0", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/react": "^18.2.66", + "@types/react-dom": "^18.2.22", + "@vitejs/plugin-react": "^4.2.1", + "eslint": "^8.57.0", + "eslint-plugin-react": "^7.34.1", + "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.6", + "vite": "^5.2.0" + } +} diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/screenshot.webp b/React-JS-Projects/Advanced/Qr-Code-Generator/screenshot.webp new file mode 100644 index 00000000..927b6476 Binary files /dev/null and b/React-JS-Projects/Advanced/Qr-Code-Generator/screenshot.webp differ diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/src/App.css b/React-JS-Projects/Advanced/Qr-Code-Generator/src/App.css new file mode 100644 index 00000000..1c9bc3f3 --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/src/App.css @@ -0,0 +1,54 @@ +@import url('http://fonts.cdnfonts.com/css/lilly'); +.App{ +display: flex; +flex-direction: column; +justify-content: center; +align-items: center; +gap: 50px; +padding-top: 30px; + +} +h1{ +font-family: 'Lilly', sans-serif; +font-size: 50px; +} +.gen input{ +height: 35px; +width: 350px; +font-size: 20px; +padding-left: 5px; +} +button{ +position: relative; +height: 38px; +width: 100px; +top: -2px; +font-size: 18px; +margin-left: 10px; +border: none; +color: whitesmoke; +background-color: forestgreen; +box-shadow: 2px 2px 5px rgb(74, 182, 74); +cursor: pointer; +} +button:active{ +box-shadow: none; +} +.extra{ +padding-top: 20px; +display: flex; +justify-content: space-around; +gap: 10px; +} +input[type="color"]{ + margin-top: 20px; +} +h5{ + font-size: 1rem; +} +.output-box{ +display: flex; +flex-direction: column; +align-items: center; +gap: 40px; +} \ No newline at end of file diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/src/App.jsx b/React-JS-Projects/Advanced/Qr-Code-Generator/src/App.jsx new file mode 100644 index 00000000..5e95ca69 --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/src/App.jsx @@ -0,0 +1,96 @@ + +import { useEffect, useState } from 'react'; +import './App.css'; + +function App() { + const [temp, setTemp] = useState(""); + const [url, setUrl] = useState(""); + const [size, setSize] = useState(250); + const [bgColor, setBgColor] = useState("ffffff"); + const [qrCode, setQrCode] = useState(""); + const [showDownloadButton, setShowDownloadButton] = useState(false); + + // Changing the URL only when the user + // changes the input + useEffect(() => { + setQrCode(`http://api.qrserver.com/v1/create-qr-code/?data=${encodeURIComponent(url)}&size=${size}x${size}&bgcolor=${bgColor}`); + }, [url, size, bgColor]); + + // Function to handle input change and validate URL + function handleInputChange(event) { + setTemp(event.target.value); + } + + // Function to handle URL submission + function handleSubmit(event) { + event.preventDefault(); + if (isValidUrl(temp)) { + setUrl(temp); + setShowDownloadButton(true); // Show the download button + } else { + alert("Invalid URL. Please enter a valid URL."); + } + } + + // Function to check if a string is a valid URL + function isValidUrl(string) { + try { + new URL(string); + return true; + } catch (_) { + return false; + } + } + + // Function to handle QR code download + function handleDownload() { + const downloadLink = document.createElement('a'); + downloadLink.href = qrCode; + downloadLink.download = 'qrcode.png'; + document.body.appendChild(downloadLink); + downloadLink.click(); + document.body.removeChild(downloadLink); + } + + return ( +
+

QR Code Generator

+
+
+
+ + +
+
+
Background Color:
+ { setBgColor(e.target.value.substring(1)) }} + /> +
Dimension:
+ { setSize(e.target.value) }} + /> +
+
+
+
+ + {showDownloadButton && qrCode && ( // Conditionally render the download button + + )} +
+
+ ); +} + +export default App; diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/src/main.jsx b/React-JS-Projects/Advanced/Qr-Code-Generator/src/main.jsx new file mode 100644 index 00000000..51a8c582 --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/src/main.jsx @@ -0,0 +1,9 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.jsx' + +ReactDOM.createRoot(document.getElementById('root')).render( + + + , +) diff --git a/React-JS-Projects/Advanced/Qr-Code-Generator/vite.config.js b/React-JS-Projects/Advanced/Qr-Code-Generator/vite.config.js new file mode 100644 index 00000000..5a33944a --- /dev/null +++ b/React-JS-Projects/Advanced/Qr-Code-Generator/vite.config.js @@ -0,0 +1,7 @@ +import { defineConfig } from 'vite' +import react from '@vitejs/plugin-react' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [react()], +}) diff --git a/React-JS-Projects/README.md b/React-JS-Projects/README.md index 5e185633..e2e20b9f 100644 --- a/React-JS-Projects/README.md +++ b/React-JS-Projects/README.md @@ -29,6 +29,7 @@ | 2 | [To Do List](./Basic/ToDo-List) | ![Basic](https://img.shields.io/badge/Basic-00FF00?style=for-the-badge) | | 3 | [Weather App](./Basic/Weather-App) | ![Basic](https://img.shields.io/badge/Basic-00FF00?style=for-the-badge) | | 4 | [Cryptocurrency Finder](./Intermediate/Cryptocurrency-Finder/) | ![Intermediate](https://img.shields.io/badge/Intermediate-FFD700?style=for-the-badge) | +| 5 | [QR Code Generator](./Advanced/Qr-Code-Generator/) | ![Advanced](https://img.shields.io/badge/Advanced-FF0000?style=for-the-badge) | diff --git a/database/react.json b/database/react.json index f54b8c39..f9406e5b 100644 --- a/database/react.json +++ b/database/react.json @@ -4,6 +4,11 @@ "title": "Cryptocurrency Finder", "description": "Cryptocurrency Finder is a React-JS project which displays different crypto coins using API." }, + { + "tag": "Advanced", + "title": "QR Code Generator", + "description": "This is React JS project which generates QR code to open the website when url is entered and also it can be downloaded." + }, { "tag": "Basic", "title": "To Do List",