const printElement = (searchElement?: any, website?: any) => { if (typeof window === 'undefined') { return false } if (typeof document !== 'undefined') { const divContents = searchElement ? document?.getElementById(searchElement)?.innerHTML : document?.querySelector('.right-panel ul')?.innerHTML const printWindow = window.open('', '', 'height=500, width=600') if (!divContents) { return null } if (printWindow && 'document' in printWindow) { printWindow.document.write( `

${ website?.url } ${website?.standard || 'Accessibility'} Report

` ) printWindow.document.write(divContents) printWindow.document.write('') printWindow.document?.close() printWindow?.print() } else { window.alert('Device not capable of printing') } } } export { printElement }