Skip to content

Commit 5c5b18e

Browse files
authored
Merge pull request #586 from topcoder-platform/TCA-1106_certificate_sharing
TCA-1106 - add print button on certificate page -> dev
2 parents ab6c408 + 0ff891e commit 5c5b18e

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src-ts/tools/learn/learn-lib/certificate-page-layout/CertificatePageLayout.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,10 @@ import { useSearchParams } from 'react-router-dom'
1010
import classNames from 'classnames'
1111

1212
import {
13-
FacebookSocialShareBtn,
1413
fileDownloadCanvasAsImage,
1514
IconOutline,
16-
LinkedinSocialShareBtn,
1715
LoadingSpinner,
1816
NavigateBackFunction,
19-
TwitterSocialShareBtn,
2017
useNavigateBack,
2118
} from '../../../../lib'
2219
import { useCertificateScaling } from '../use-certificate-scaling-hook'
@@ -25,6 +22,7 @@ import { ActionButton } from '../action-button'
2522
import { hideSiblings } from '../functions'
2623
import { getViewStyleParamKey } from '../../learn.routes'
2724
import { TCAShareCertificateModalData, useTCAShareCertificateModal } from '../tca-share-certificate-modal'
25+
import { useCertificatePrint } from '../use-certificate-print-hook'
2826

2927
import styles from './CertificatePageLayout.module.scss'
3028

@@ -77,6 +75,9 @@ const CertificatePageLayout: FC<CertificatePageLayoutProps> = (props: Certificat
7775

7876
}, [props.title, getCertificateCanvas])
7977

78+
const handlePrint: () => Promise<void>
79+
= useCertificatePrint(props.certificateElRef, props.title ?? '')
80+
8081
useLayoutEffect(() => {
8182
const el: HTMLElement = wrapElRef.current
8283
if (props.fullScreenCertLayout !== true || !el) {
@@ -120,6 +121,10 @@ const CertificatePageLayout: FC<CertificatePageLayoutProps> = (props: Certificat
120121
)
121122
}
122123
>
124+
<ActionButton
125+
icon={<IconOutline.PrinterIcon />}
126+
onClick={handlePrint}
127+
/>
123128
<ActionButton
124129
icon={<IconOutline.DownloadIcon />}
125130
onClick={handleDownload}

0 commit comments

Comments
 (0)