-
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.
OM-347: create a voucher public page (#74)
* OM-347: create a voucher public page * OM-347: add warning state * OM-330: add qr codes to vouchers (#81) * OM-347: adjust public page, add toasts to worker page
- Loading branch information
1 parent
c838669
commit 5558552
Showing
16 changed files
with
453 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
"dist" | ||
], | ||
"dependencies": { | ||
"react-qr-code": "^2.0.15", | ||
"react-to-print": "^2.15.1" | ||
} | ||
} |
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
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,45 @@ | ||
import React from 'react'; | ||
import QRCode from 'react-qr-code'; | ||
import { makeStyles } from '@material-ui/styles'; | ||
|
||
import { Grid } from '@material-ui/core'; | ||
|
||
const useStyles = makeStyles(() => ({ | ||
qrContainer: { | ||
height: 'auto', | ||
margin: '12px auto', | ||
maxWidth: 128, | ||
width: '100%', | ||
}, | ||
qrCode: { | ||
height: 'auto', | ||
maxWidth: '100%', | ||
width: '100%', | ||
}, | ||
})); | ||
|
||
export default function VoucherQRCode({ voucher, bgColor = '#e4f2ff' }) { | ||
const classes = useStyles(); | ||
|
||
if (!voucher) { | ||
return null; | ||
} | ||
|
||
const voucherUrl = new URL(`${window.location.origin}${process.env.PUBLIC_URL}/voucher/check/${voucher.code}`); | ||
|
||
return ( | ||
<Grid item xs={12}> | ||
<div className={classes.qrContainer}> | ||
<QRCode | ||
size={128} | ||
className={classes.qrCode} | ||
value={voucherUrl.toString()} | ||
viewBox="0 0 256 256" | ||
level="H" | ||
bgColor={bgColor} | ||
fgColor="#000000" | ||
/> | ||
</div> | ||
</Grid> | ||
); | ||
} |
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
Oops, something went wrong.