-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
46 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React, { useState, useEffect } from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
const PdfAlert = () => { | ||
const pdfCertWarningId = 'pdf-cert-warning'; | ||
const pdfCertWarningElement = document.getElementById(pdfCertWarningId); | ||
const [ | ||
pdfCertWarningElementCreated, | ||
setPdfCertWarningElementCreated, | ||
] = useState(false); | ||
|
||
useEffect(() => { | ||
const domNode = document.createElement('div'); | ||
domNode.setAttribute('id', pdfCertWarningId); | ||
|
||
const introTextNode = document.getElementsByClassName('va-introtext')[0]; | ||
const introTextParentNode = introTextNode?.parentNode; | ||
if (introTextNode && introTextParentNode) { | ||
introTextParentNode.insertBefore(domNode, introTextNode); | ||
setPdfCertWarningElementCreated(true); | ||
} | ||
}, []); | ||
|
||
if (!pdfCertWarningElementCreated || !pdfCertWarningElement) { | ||
return <></>; | ||
} | ||
|
||
return ReactDOM.createPortal( | ||
<va-alert> | ||
<h2 slot="headline" className="vads-u-font-size--h3"> | ||
We’re updating our forms | ||
</h2> | ||
<p> | ||
After January 7, 2023, you won’t be able to use VA forms that have a | ||
“last updated” date before March 2022. If you downloaded any of these | ||
older VA forms, you may need to download new copies in January. | ||
</p> | ||
</va-alert>, | ||
pdfCertWarningElement, | ||
); | ||
}; | ||
|
||
export default PdfAlert; |