-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In mobile screens display sticky the QRbutton at the bottom right of …
…the screen and create a component for this button
- Loading branch information
1 parent
f5f1354
commit 2bb1cce
Showing
4 changed files
with
45 additions
and
41 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,35 @@ | ||
import React from 'react'; | ||
import { BsQrCodeScan } from 'react-icons/bs'; | ||
|
||
const QRButton = ({ openQRScanner, isSmallScreen }) => { | ||
const isMobile = window.innerWidth <= 480; | ||
const buttonClass = "px-2 py-2 mb-2 text-white bg-custom-blue hover:bg-custom-blue-hover focus:ring-4 focus:outline-none focus:ring-custom-blue font-medium rounded-lg text-sm px-4 py-2 text-center dark:bg-custom-blue-hover dark:hover:bg-custom-blue-hover dark:focus:ring-custom-blue-hover shadow-md"; | ||
|
||
if (isMobile) { | ||
return ( | ||
<button | ||
className={`fixed z-20 bottom-20 right-5 ${buttonClass}`} | ||
onClick={openQRScanner} | ||
> | ||
<div className="flex items-center"> | ||
<BsQrCodeScan size={20} className="text-white" /> | ||
</div> | ||
</button> | ||
); | ||
} else if (isSmallScreen) { | ||
return ( | ||
<button | ||
className={buttonClass} | ||
onClick={openQRScanner} | ||
> | ||
<div className="flex items-center"> | ||
<BsQrCodeScan size={20} className="text-white" /> | ||
</div> | ||
</button> | ||
); | ||
} | ||
|
||
return null; | ||
}; | ||
|
||
export default QRButton; |
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