Skip to content

Commit 2b17fca

Browse files
committed
feat: replace usage of react-to-print with react-pdf
1 parent d4dc266 commit 2b17fca

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

frontend/src/features/admin-form/responses/IndividualResponsePage/IndividualResponseNavbar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ import { useUser } from '~features/user/queries'
3333

3434
import { useUnlockedResponses } from '../ResponsesPage/storage/UnlockedResponses/UnlockedResponsesProvider'
3535

36-
import PrintableResponse from './PrintableResponse'
3736
import { useIndividualSubmission } from './queries'
37+
import { ResponsePdfDownloadLink } from './utils/ResponsePdf'
3838

3939
export const IndividualResponseNavbar = (): JSX.Element => {
4040
const { state } = useLocation()
@@ -190,7 +190,7 @@ export const IndividualResponseNavbar = (): JSX.Element => {
190190
}}
191191
variant="clear"
192192
/>
193-
<PrintableResponse ref={printableResponseRef} />
193+
<ResponsePdfDownloadLink />
194194
</Box>
195195
)}
196196
</Stack>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Document, Page, View, Text, PDFDownloadLink } from '@react-pdf/renderer'
2+
3+
const ResponsePdf: React.FC = () => (
4+
<Document>
5+
<Page>
6+
<View>
7+
<Text>Response PDF Placeholder</Text>
8+
</View>
9+
</Page>
10+
</Document>
11+
)
12+
13+
export const ResponsePdfDownloadLink = () => (
14+
<PDFDownloadLink document={<ResponsePdf />} fileName="response.pdf">
15+
Download PDF
16+
</PDFDownloadLink>
17+
)
18+

0 commit comments

Comments
 (0)