Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README file for QR Code Generator project:


QR Code Generator

This is a simple React-based web application that generates customizable QR codes. Users can input a URL, select a color for the QR code, and generate it. The application also allows users to quickly generate a default black-and-white QR code, download the generated QR code as an image, or copy it to the clipboard.

Features

  • Input a URL to generate a QR code.
  • Select different colors for the QR code (white, yellow, red, green, blue) with a black background.
  • "Quick Generate" button to generate a default black-and-white QR code.
  • Download the QR code as a .png image.
  • Copy the generated QR code to the clipboard.
  • Reset form to start over.

Technologies Used

  • React: For building the user interface and state management.
  • qrcode: For generating QR codes and rendering them onto a canvas.

Installation and Setup

Prerequisites

Make sure you have Node.js and npm installed on your machine. You can download Node.js from here.

Steps to Run the Application Locally

  1. Clone this repository to your local machine:

    git clone https://github.com/your-username/qr-code-generator.git
  2. Navigate into the project directory:

    cd qr-code-generator
  3. Install the dependencies:

    npm install
  4. Start the development server:

    npm start
  5. Open your browser and go to http://localhost:3000 to use the application.

Dependencies

  • react: The core library for building the app.
  • qrcode: A library for generating QR codes.

You can install the qrcode library using:

npm install qrcode

How to Use

  1. Generate a QR Code:

    • Enter a URL in the input field.
    • Select a color for the QR code using the provided radio buttons.
    • Click the "Generate" button to generate the QR code with your selected color and URL.
  2. Quick Generate:

    • Click the "Quick Generate" button to instantly create a black-and-white QR code for the entered URL.
  3. Download the QR Code:

    • After generating the QR code, click the "Download QR" button to download the QR code image as a .png file.
  4. Copy the QR Code:

    • After generating the QR code, click the "Copy QR" button to copy the QR code image to your clipboard.
  5. Reset:

    • Click the "Reset" button to clear the form and canvas, allowing you to generate a new QR code.

File Structure

qr-code-generator/
├── node_modules/       # Dependencies
├── public/             # Public files (index.html, etc.)
├── src/
│   ├── App.js          # Main App component
│   └── index.js        # Entry point
├── .gitignore          # Ignored files for Git
├── package.json        # Project metadata and dependencies
└── README.md           # Project documentation

Code Overview

The main component is QrCodeGenerator, which:

  • Manages the input for the URL (url) and color (color) using the useState hook.
  • Uses the qrcode library to generate a QR code on a <canvas> element.
  • Provides functions for generating QR codes, downloading them, and copying them to the clipboard.

Key Functions

  • generateQRCode(): Generates a custom QR code based on the URL and selected color.
  • quickGenerate(): Quickly generates a black-and-white QR code.
  • downloadQRCode(): Allows the user to download the QR code as a .png image.
  • copyQRCode(): Copies the generated QR code image to the clipboard.
  • reset(): Resets the form and canvas.

Potential Future Enhancements

  • Error Handling: Improve the UX by providing clearer feedback on invalid URLs.
  • Customization: Allow more customization options such as setting different background colors or adjusting the size of the QR code.
  • History: Implement a feature to save previously generated QR codes.

Author

  • Arya's QR Code Generator

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages