BeritaAcara_A.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React, { useRef, Component } from 'react';
  2. import { useReactToPrint } from "react-to-print";
  3. import { Row, Col, Button, Card, CardBody } from "reactstrap";
  4. import Head from 'next/head'
  5. import SignatureCanvas from 'react-signature-canvas'
  6. import ComponentToPrint from "./SuratBA";
  7. import ReactToPrint, { PrintContextConsumer } from 'react-to-print';
  8. import { getOneLaporan, updateLaporan } from "@/actions/pelaporan";
  9. class BeritaAcara extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. };
  14. }
  15. static getInitialProps = async ({ query }) => {
  16. return { query };
  17. };
  18. content = () => {
  19. <ComponentToPrint />
  20. }
  21. render() {
  22. return (
  23. <div>
  24. <ReactToPrint pageStyle='print' content={() => this.componentRef}>
  25. <PrintContextConsumer>
  26. {({ handlePrint }) => (
  27. <div className=' content-heading border-radius-login'>
  28. <span className="btn-radius">
  29. <Button onClick={handlePrint} color className="btn-labeled-4">
  30. <h4 className="p-0 mt-2">Print dan Download</h4>
  31. </Button>
  32. </span>
  33. </div>
  34. )}
  35. </PrintContextConsumer>
  36. </ReactToPrint>
  37. {/* <div style={{ display: "none" }}> */}
  38. <ComponentToPrint ref={el => (this.componentRef = el)} query={this.props.query} dataPelanggaran={this.props.dataPelanggaran} />
  39. {/* </div> */}
  40. {/* <Card>
  41. <CardBody>
  42. jajajaj
  43. </CardBody>
  44. </Card> */}
  45. </div >
  46. );
  47. }
  48. }
  49. export default BeritaAcara