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
185 lines (163 loc) • 2.96 kB
CSS
.qr-scanner-container {
position: relative;
width: 100%;
height: 100%;
min-height: 400px;
background-color: #000;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
.qr-scanner-video {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.qr-scanner-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
pointer-events: none;
}
.scan-region {
position: relative;
width: 250px;
height: 250px;
border: 2px solid transparent;
}
.corner {
position: absolute;
width: 20px;
height: 20px;
border: 3px solid #00ff00;
}
.corner.top-left {
top: 0;
left: 0;
border-right: none;
border-bottom: none;
}
.corner.top-right {
top: 0;
right: 0;
border-left: none;
border-bottom: none;
}
.corner.bottom-left {
bottom: 0;
left: 0;
border-right: none;
border-top: none;
}
.corner.bottom-right {
bottom: 0;
right: 0;
border-left: none;
border-top: none;
}
.scan-line {
position: absolute;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #00ff00, transparent);
animation: scan 2s linear infinite;
}
@keyframes scan {
0% {
transform: translateY(-125px);
}
100% {
transform: translateY(125px);
}
}
.scan-hint {
margin-top: 20px;
color: #fff;
font-size: 14px;
text-align: center;
background-color: rgba(0, 0, 0, 0.5);
padding: 8px 16px;
border-radius: 20px;
}
.qr-scanner-permission,
.qr-scanner-error {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 40px;
text-align: center;
color: #fff;
}
.permission-icon,
.error-icon {
font-size: 48px;
margin-bottom: 20px;
}
.qr-scanner-permission h3,
.qr-scanner-error h3 {
font-size: 24px;
margin-bottom: 10px;
}
.qr-scanner-permission p,
.qr-scanner-error p {
font-size: 16px;
margin-bottom: 20px;
opacity: 0.8;
}
.permission-button,
.retry-button,
.start-scan-button,
.stop-scan-button {
background-color: #007AFF;
color: white;
border: none;
padding: 12px 24px;
font-size: 16px;
font-weight: 600;
border-radius: 8px;
cursor: pointer;
transition: background-color 0.2s;
}
.permission-button:hover,
.retry-button:hover,
.start-scan-button:hover {
background-color: #0062CC;
}
.stop-scan-button {
position: absolute;
bottom: 40px;
left: 50%;
transform: translateX(-50%);
background-color: #FF3B30;
pointer-events: all;
}
.stop-scan-button:hover {
background-color: #D70015;
}
.qr-scanner-controls {
display: flex;
align-items: center;
justify-content: center;
padding: 40px;
}
/* Dark mode support */
@media (prefers-color-scheme: light) {
.qr-scanner-container {
background-color: #f5f5f5;
}
.qr-scanner-permission,
.qr-scanner-error {
color: #333;
}
}