Skip to content

Commit

Permalink
Merge pull request #196 from cisagov/169-generate-pdf-button-for-rsc-…
Browse files Browse the repository at this point in the history
…dashboard

#169 Generate PDF Button for RSC Dashboard
  • Loading branch information
schmelz21 authored Apr 30, 2024
2 parents f0e3209 + 3632551 commit 708a7ba
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"react-select": "^5.5.9",
"react-simple-maps": "^3.0.0",
"react-table": "^7.8.0",
"react-to-print": "^2.15.1",
"resolve-url-loader": "^5.0.0",
"universal-cookie": "^4.0.4",
"uswds": "^2.13.3",
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/ReadySetCyber/RSCDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { RSCNextSteps } from './RSCNextSteps';
import { RSCAccordionNav } from './RSCAccordionNav';
import { FloatingNav } from './FloatingNav';
import { ScrollTop } from './ScrollTop';
import { useReactToPrint } from 'react-to-print';

export const RSCDetail: React.FC = () => {
const { apiGet } = useAuthContext();
Expand Down Expand Up @@ -45,6 +46,13 @@ export const RSCDetail: React.FC = () => {
fetchResult();
}, [fetchResult]);

const printRef = React.useRef<HTMLDivElement>(null);

const handleDownloadPDF = useReactToPrint({

Check warning on line 51 in frontend/src/components/ReadySetCyber/RSCDetail.tsx

View workflow job for this annotation

GitHub Actions / lint

'handleDownloadPDF' is assigned a value but never used
content: () => printRef.current,
documentTitle: `ReadySetCyber Summary ${new Date().toLocaleDateString()}`
});

return (
<>
<Box sx={{ flexGrow: 1, padding: 2 }}>
Expand Down

0 comments on commit 708a7ba

Please sign in to comment.