Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedtalhaouii authored Oct 16, 2024
1 parent a7c19d7 commit 90098ab
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 0 deletions.
22 changes: 22 additions & 0 deletions index.html
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>&copy; 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>
28 changes: 28 additions & 0 deletions script.js
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';
}
});
91 changes: 91 additions & 0 deletions style.css
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);
}
}

0 comments on commit 90098ab

Please sign in to comment.