Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
153 lines (113 loc) · 3.56 KB
/
Copy pathindex.html
File metadata and controls
153 lines (113 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<!-- twitter / ig @cicciosgamino
_______ _ _
/ ____(_)_________(_)___ _________ _____ _____ ___ (_)___ ____
/ / / / ___/ ___/ / __ \/ ___/ __ `/ __ `/ __ `__ \/ / __ \/ __ \
/ /___/ / /__/ /__/ / /_/ (__ ) /_/ / /_/ / / / / / / / / / / /_/ /
\____/_/\___/\___/_/\____/____/\__, /\__,_/_/ /_/ /_/_/_/ /_/\____/
/____/
-->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="author" content="@cicciosgamino">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>QrCode Example</title>
<style>
* {
/* reset browser defaults */
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
/* base rem unit (10px) */
font-size: 62.5%;
block-size: 100%;
background-color: var(--surface1);
color: var(--text1);
}
body {
padding: 7rem;
font-family: system-ui, sans-serif;
font-size: 2rem;
display: grid;
place-content: center;
gap: 5rem;
}
.text {
inline-size: 100%;
position: relative;
}
/* --------------------------------- Input ----------------------------- */
input {
border: none;
background-image: none;
background-color: transparent;
box-shadow: none;
border-bottom: 1px solid #333;
}
input, textarea {
inline-size: 100%;
padding: 1.3rem;
}
input:focus {
border-bottom: 1px solid purple;
outline: 1px solid purple;
}
input:not(:focus):valid {
background-color: transparent;
}
label {
position: absolute;
top: -3.1rem;
left: 1rem;
font-size: 1.9rem;
}
qr-code-element {
--size: 33rem;
/* neede only if you slot the center svg image */
--icon-size: 6.7rem;
}
</style>
</head>
<body>
<div class="text">
<input
id="qrtext"
type="text"
name="qrtext"
placeholder="text here ...">
<label for="qrtext">QrText</label>
</div>
<!-- grapich-element is SVG by default -->
<qr-code-element text="Hello World">
<!-- <qr-code-element
text="Hello World"
error-correction="medium"
graphic-element="canvas"
mask-pattern="-1"> -->
<!-- center icon | set slot="icon" attribute
<svg version="1.1" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" slot="icon">
<ellipse cx="24" cy="24.187" rx="24" ry="23.813" fill="#fff" stop-color="#000000" style="paint-order:stroke fill markers"/>
<path d="m14.784 13.284a1.5002 1.5002 0 0 0-1.5 1.5v18.432a1.5002 1.5002 0 0 0 1.5 1.5h18.432a1.5002 1.5002 0 0 0 1.5-1.5v-18.432a1.5002 1.5002 0 0 0-1.5-1.5zm1.5 3h15.432v15.432h-15.432zm10.074 7.0645-3.2324 4.2383-2.1348-2.7305-2.9199 3.8613h12.273z" color="#000000" style="-inkscape-stroke:none;paint-order:stroke fill markers"/>
</svg> -->
</qr-code-element>
<noscript>
Please enable JavaScript to view this website.
</noscript>
<!-- Import Js Module -->
<script type="module" src="qr-code-element.js"></script>
<script>
window.addEventListener('DOMContentLoaded', (e) => {
const qrText = document.getElementById('qrtext')
const qrCodeElement = document.querySelector('qr-code-element')
// get the statistics if you need
// qrCodeElement.getStatistics()
qrText.addEventListener('input', (e) => {
qrCodeElement.setAttribute('text', event.target.value)
})
})
</script>
</body>
</html>