feat(barcode reader): add close btn
This commit is contained in:
@@ -13,7 +13,22 @@
|
|||||||
width: var(--video-width);
|
width: var(--video-width);
|
||||||
background-color: #000000;
|
background-color: #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.close-btn {
|
||||||
|
background: none;
|
||||||
|
border-radius: 50%;
|
||||||
|
border-style: none;
|
||||||
|
color: white;
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-right: 12px;
|
||||||
|
margin-top: 12px;
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: 101;
|
||||||
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1024px) {
|
@media screen and (min-width: 1024px) {
|
||||||
#container {
|
#container {
|
||||||
min-width: 400px;
|
min-width: 400px;
|
||||||
|
|||||||
@@ -24,10 +24,16 @@ export class BarcodeReader extends HTMLElement {
|
|||||||
link.rel = 'stylesheet';
|
link.rel = 'stylesheet';
|
||||||
link.href = '/barcode-reader/barcode-reader.css';
|
link.href = '/barcode-reader/barcode-reader.css';
|
||||||
this.container.setAttribute('id', 'container');
|
this.container.setAttribute('id', 'container');
|
||||||
|
const closeBtn = document.createElement('button');
|
||||||
|
closeBtn.textContent = 'X';
|
||||||
|
closeBtn.onclick = this.stopScan.bind(this);
|
||||||
|
closeBtn.classList.add('close-btn')
|
||||||
|
this.container.appendChild(closeBtn);
|
||||||
const videoContainer = document.createElement('div');
|
const videoContainer = document.createElement('div');
|
||||||
videoContainer.setAttribute('id', 'video-container');
|
videoContainer.setAttribute('id', 'video-container');
|
||||||
this.container.appendChild(videoContainer);
|
this.container.appendChild(videoContainer);
|
||||||
|
|
||||||
|
|
||||||
const overlay = document.createElement('div');
|
const overlay = document.createElement('div');
|
||||||
overlay.classList.add('overlay');
|
overlay.classList.add('overlay');
|
||||||
this.video.setAttribute('autoplay', '');
|
this.video.setAttribute('autoplay', '');
|
||||||
|
|||||||
Reference in New Issue
Block a user