From 10dbff87243b91fb4e50a86f1ec4cc30d5c63dc0 Mon Sep 17 00:00:00 2001 From: MikunoNaka Date: Mon, 12 Jul 2021 10:42:05 +0530 Subject: implemented sleek way to handle generating PDFs --- src/components/Menu/Menu.scss | 11 +++++++++++ src/components/Menu/SubmitMenu.tsx | 39 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 src/components/Menu/SubmitMenu.tsx (limited to 'src/components/Menu') diff --git a/src/components/Menu/Menu.scss b/src/components/Menu/Menu.scss index cf9f7aa..93d6c5e 100644 --- a/src/components/Menu/Menu.scss +++ b/src/components/Menu/Menu.scss @@ -23,3 +23,14 @@ .InvoiceInfoMenu { width: 60%; } + +.PDFViewer { + height: 95%; + width: 95%; + + position: fixed; + top: 0; bottom: 0; + left: 0; right: 0; + margin: auto; + z-index: 3; +} diff --git a/src/components/Menu/SubmitMenu.tsx b/src/components/Menu/SubmitMenu.tsx new file mode 100644 index 0000000..599b181 --- /dev/null +++ b/src/components/Menu/SubmitMenu.tsx @@ -0,0 +1,39 @@ +/* + * OpenBills - Self hosted browser app to generate and keep track of simple invoices + * Version - 0 + * Licensed under the MIT license - https://opensource.org/licenses/MIT + * + * Copyright (c) 2021 Vidhu Kant Sharma +*/ + +import React, { useState, Dispatch, SetStateAction } from "react"; +import { PDFViewer } from '@react-pdf/renderer'; +import PrintableDoc from "./../Print/PrintableDoc"; + +interface Props { + setVisibility: Dispatch> // this component's visibility +} + +const TransportForm: React.FC = (props) => { + const [showPDF, setShowPDF] = useState(false); + const hideSelf = () => + props.setVisibility(false); + + const closeOnBGClicked = (event: any) => + event.target.className === "floatingMenuBG" && hideSelf(); + + return ( +
+ {showPDF && + + + + } +
+ +
+
+ ); +} + +export default TransportForm; -- cgit v1.2.3