UNPKG

code-craft-studio

Version:

A comprehensive QR code and barcode scanning/generation library for React. Works with or without Capacitor. Supports 22+ QR data types and 14+ barcode formats (EAN, UPC, Code 128, etc.), with customizable designs, analytics, and React components. Provider

249 lines (217 loc) 3.93 kB
.barcode-scanner { background-color: #000; overflow: hidden; } .barcode-scanner-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; pointer-events: none; } /* Scanning frame */ .scanning-frame { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 250px; height: 250px; pointer-events: none; } .corner { position: absolute; width: 20px; height: 20px; border: 3px solid #00ff00; } .corner-tl { top: 0; left: 0; border-right: none; border-bottom: none; } .corner-tr { top: 0; right: 0; border-left: none; border-bottom: none; } .corner-bl { bottom: 0; left: 0; border-right: none; border-top: none; } .corner-br { bottom: 0; right: 0; border-left: none; border-top: none; } /* Control buttons */ .scanner-controls { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; gap: 15px; pointer-events: auto; } .torch-button, .format-selector-toggle { width: 50px; height: 50px; border-radius: 50%; border: 2px solid #fff; background-color: rgba(0, 0, 0, 0.5); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; } .torch-button:hover, .format-selector-toggle:hover { background-color: rgba(255, 255, 255, 0.2); } .torch-button.enabled { background-color: #ffd700; color: #000; } /* Format selector */ .format-selector { position: relative; } .format-dropdown { position: absolute; bottom: 60px; left: 50%; transform: translateX(-50%); background-color: rgba(0, 0, 0, 0.9); border: 1px solid #fff; border-radius: 8px; padding: 10px; min-width: 200px; max-height: 300px; overflow-y: auto; display: none; pointer-events: auto; } .format-selector:hover .format-dropdown { display: block; } .format-group { margin-bottom: 15px; } .format-group:last-child { margin-bottom: 0; } .format-group-label { color: #00ff00; font-weight: bold; font-size: 12px; margin-bottom: 5px; text-transform: uppercase; } .format-option { display: flex; align-items: center; color: #fff; font-size: 12px; margin-bottom: 3px; cursor: pointer; } .format-option input[type="checkbox"] { margin-right: 8px; } /* Product info overlay */ .product-info-overlay { position: absolute; top: 20px; left: 50%; transform: translateX(-50%); background-color: rgba(0, 0, 0, 0.8); border: 2px solid #00ff00; border-radius: 8px; padding: 15px; min-width: 250px; pointer-events: auto; } .product-info h3 { color: #fff; margin: 0 0 10px 0; font-size: 18px; } .product-info p { color: #ccc; margin: 5px 0; font-size: 14px; } .product-info .brand { color: #00ff00; } .product-info .price { color: #ffd700; font-size: 16px; font-weight: bold; } .product-info .barcode { font-family: monospace; font-size: 12px; } .product-info .format { font-size: 11px; text-transform: uppercase; opacity: 0.7; } /* Instructions */ .scanner-instructions { position: absolute; top: 50%; left: 50%; transform: translate(-50%, calc(-50% + 140px)); color: #fff; font-size: 14px; text-align: center; background-color: rgba(0, 0, 0, 0.5); padding: 5px 15px; border-radius: 20px; } /* Responsive adjustments */ @media (max-width: 480px) { .scanning-frame { width: 200px; height: 200px; } .torch-button, .format-selector-toggle { width: 40px; height: 40px; } .scanner-instructions { font-size: 12px; } } /* Animation for scanning effect */ @keyframes scan-line { 0% { top: 0; } 100% { top: 100%; } } .scanning-frame::after { content: ''; position: absolute; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, #00ff00, transparent); animation: scan-line 2s linear infinite; }