1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Merge branch 'dev' into 'master'

Dev

See merge request turris/reforis/foris-js!106
This commit is contained in:
Bogdan Bodnar 2020-03-26 16:29:27 +01:00
commit 8ec0392852
3 changed files with 4235 additions and 4398 deletions

8578
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "foris",
"version": "4.4.0",
"version": "4.5.0",
"description": "Set of components and utils for Foris and its plugins.",
"author": "CZ.NIC, z.s.p.o.",
"repository": {
@ -14,10 +14,9 @@
"license": "GPL-3.0",
"main": "./src/index.js",
"dependencies": {
"axios": "^0.19.1",
"axios": "^0.19.2",
"immutability-helper": "3.0.1",
"moment": "^2.24.0",
"pdfmake": "^0.1.63",
"qrcode.react": "^0.9.3",
"react-datetime": "^2.16.3",
"react-uid": "^2.2.0"
@ -30,26 +29,26 @@
"react-router-dom": "^5.1.2"
},
"devDependencies": {
"@babel/cli": "^7.7.7",
"@babel/core": "^7.7.7",
"@babel/plugin-transform-runtime": "^7.7.6",
"@babel/preset-env": "^7.7.7",
"@babel/preset-react": "^7.7.4",
"@fortawesome/fontawesome-free": "^5.12.0",
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-transform-runtime": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"@fortawesome/fontawesome-free": "^5.13.0",
"@testing-library/react": "^8.0.9",
"babel-loader": "^8.0.6",
"babel-loader": "^8.1.0",
"babel-polyfill": "^6.26.0",
"eslint": "^6.8.0",
"eslint-config-reforis": "^1.0.0",
"jest": "^25.1.0",
"jest": "^25.2.0",
"jest-mock-axios": "^3.2.0",
"moment-timezone": "^0.5.27",
"moment-timezone": "^0.5.28",
"prop-types": "15.7.2",
"react": "16.9.0",
"react-dom": "16.9.0",
"react-router-dom": "^5.1.2",
"react-styleguidist": "^10.4.2",
"snapshot-diff": "^0.5.1"
"react-styleguidist": "^10.6.2",
"snapshot-diff": "^0.7.0"
},
"scripts": {
"lint": "eslint src",

View File

@ -5,22 +5,36 @@
* See /LICENSE for more information.
*/
import pdfMake from "pdfmake";
export function createAndDownloadPdf(SSID, password) {
const docDefinition = {
content: [
{
text: "Wi-Fi", style: "header", fontSize: 55, alignment: "center",
text: "Wi-Fi",
style: "header",
fontSize: 55,
alignment: "center",
},
{
qr: toQRCodeContent(SSID, password), fit: "350", margin: [0, 80], alignment: "center",
qr: toQRCodeContent(SSID, password),
fit: "350",
margin: [0, 80],
alignment: "center",
},
{
text: `SSID: ${SSID}`,
fontSize: 25,
alignment: "center",
},
{
text: `Password: ${password}`,
fontSize: 25,
alignment: "center",
},
{ text: `SSID: ${SSID}`, fontSize: 25, alignment: "center" },
{ text: `Password: ${password}`, fontSize: 25, alignment: "center" },
],
};
pdfMake.createPdf(docDefinition).download("wifi.pdf");
// pdfmake is exposed by reForis main application. Thus we can use it from globals.
window.pdfMake.createPdf(docDefinition).download("wifi.pdf");
}
export function toQRCodeContent(SSID, password) {