-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a7c19d7
commit 90098ab
Showing
3 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>QR Code Generator | Mohamed Talhaoui</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="qr-card"> | ||
<h1>QR Code Generator</h1> | ||
<input type="text" id="qr-text" placeholder="Enter text or URL"> | ||
<div id="qrcode"></div> | ||
</div> | ||
<footer> | ||
<p>© 2024 | Mohamed Talhaoui. All rights reserved.</p> | ||
</footer> | ||
|
||
<script src="script.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const qrCodeDiv = document.getElementById('qrcode'); | ||
const qrTextInput = document.getElementById('qr-text'); | ||
|
||
function generateQRCode(text) { | ||
qrCodeDiv.innerHTML = ""; | ||
|
||
new QRCode(qrCodeDiv, { | ||
text: text, | ||
width: 128, | ||
height: 128, | ||
}); | ||
|
||
|
||
qrCodeDiv.style.display = 'block'; | ||
qrCodeDiv.style.opacity = 0; | ||
setTimeout(() => { | ||
qrCodeDiv.style.opacity = 1; | ||
}, 10); | ||
} | ||
|
||
qrTextInput.addEventListener('input', (event) => { | ||
const text = event.target.value; | ||
if (text) { | ||
generateQRCode(text); | ||
} else { | ||
qrCodeDiv.style.display = 'none'; | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
@import url('https://fonts.googleapis.com/css2?family=Afacad+Flux:[email protected]&display=swap'); | ||
|
||
body { | ||
font-family: 'Afacad Flux', sans-serif; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
margin: 0; | ||
background-color: #f4f4f9; | ||
} | ||
|
||
.qr-card { | ||
background-color: white; | ||
padding: 20px; | ||
border-radius: 10px; | ||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2); | ||
text-align: center; | ||
transition: transform 0.3s ease, box-shadow 0.3s ease; | ||
} | ||
|
||
.qr-card:hover { | ||
transform: translateY(-5px); | ||
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3); | ||
} | ||
|
||
.qr-card h1 { | ||
margin-bottom: 20px; | ||
color: #333; | ||
animation: fadeIn 0.5s ease forwards; | ||
} | ||
|
||
.qr-card input { | ||
padding: 10px; | ||
border-radius: 5px; | ||
border: 1px solid #ccc; | ||
width: 80%; | ||
transition: border-color 0.3s ease; | ||
} | ||
|
||
.qr-card input:focus { | ||
border-color: #5cb85c; | ||
outline: none; | ||
} | ||
|
||
.qr-card button { | ||
margin-top: 10px; | ||
padding: 10px 20px; | ||
border: none; | ||
background-color: #5cb85c; | ||
color: white; | ||
border-radius: 5px; | ||
cursor: pointer; | ||
transition: background-color 0.3s ease, transform 0.2s ease; | ||
} | ||
|
||
.qr-card button:hover { | ||
background-color: #4cae4c; | ||
transform: translateY(-2px); | ||
} | ||
|
||
#qrcode { | ||
display: none; | ||
width: 128px; | ||
height: 128px; | ||
margin-left: 60px; | ||
margin-top: 20px; | ||
transition: opacity 0.5s ease; | ||
} | ||
|
||
footer { | ||
position: absolute; | ||
bottom: 0; | ||
width: 100%; | ||
text-align: center; | ||
padding: 10px 0; | ||
background-color: #333; | ||
color: white; | ||
font-size: 14px; | ||
} | ||
|
||
@keyframes fadeIn { | ||
from { | ||
opacity: 0; | ||
transform: translateY(-10px); | ||
} | ||
to { | ||
opacity: 1; | ||
transform: translateY(0); | ||
} | ||
} |