-
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.
Add QR Code Page Change links to the pages
- Loading branch information
1 parent
4309867
commit 6ec7c57
Showing
6 changed files
with
83 additions
and
120 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
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
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
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
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 |
---|---|---|
@@ -1,33 +1,7 @@ | ||
import React, { useState } from 'react'; | ||
import {generateQRCode} from './api'; | ||
|
||
function App() { | ||
const [qrDate, setQrData] = useState('example.com'); | ||
const [qrSize, setQrSize] = useState('200x200'); | ||
|
||
return ( | ||
<div className='app-container'> | ||
<h1 className='app-title'>QR Code Generator</h1> | ||
<div className='input-container'> | ||
<label className="input-label">QR URL:</label> | ||
<input className='input-field' type="text" value={qrDate} onChange={(e) => setQrData(e.target.value)} /> | ||
</div> | ||
<div className='input-container'> | ||
<label className="input-label">QR Size:</label> | ||
<input className='input-field' type="text" value={qrSize} onChange={(e) => setQrSize(e.target.value)} /> | ||
</div> | ||
<div className='qr-code'> | ||
<img className='qr-image' src={generateQRCode(qrDate, qrSize)} alt='QR Code' /> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default App; | ||
|
||
const qrServerBaseUrl = "https://api.qrserver.com/v1/create-qr-code/" | ||
|
||
export const generateQRCode = (qrData, qrSize) => { | ||
const qrImageUrl = `${qrServerBaseUrl}?data=${qrData}&size=${qrSize}`; | ||
return qrImageUrl; | ||
}; | ||
const background = document.querySelector('html'); | ||
const contentContainer = document.querySelector('.content-container'); | ||
const parallaxSpeed = 0.5; | ||
window.addEventListener('scroll', function () { | ||
const scrollPosition = window.scrollY; | ||
background.style.backgroundPositionY = -scrollPosition * parallaxSpeed + 'px'; | ||
}); |
Oops, something went wrong.