-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
0336a17
commit cfe88eb
Showing
4 changed files
with
48 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useEffect } from 'react' | ||
|
||
const ActionNetworkWidget: React.FC = () => { | ||
useEffect(() => { | ||
// Create a link element for the CSS file | ||
const link = document.createElement('link') | ||
link.href = 'https://actionnetwork.org/css/style-embed-v3.css' | ||
link.rel = 'stylesheet' | ||
|
||
// Create a script element for the widget | ||
const script = document.createElement('script') | ||
script.src = | ||
'https://actionnetwork.org/widgets/v5/event/red-ccn-4-21?format=js&source=widget' | ||
script.async = true | ||
|
||
// Append both link and script elements to the document body | ||
document.body.appendChild(link) | ||
document.body.appendChild(script) | ||
|
||
// Cleanup function to remove the link and script when component unmounts | ||
return () => { | ||
document.body.removeChild(link) | ||
document.body.removeChild(script) | ||
} | ||
}, []) // Empty dependency array ensures this effect runs only once | ||
|
||
return ( | ||
<div | ||
id="can-event-area-red-ccn-4-21" | ||
style={{ width: '90%', margin: '0 auto' }} | ||
> | ||
{/* This div is the target for our HTML insertion */} | ||
</div> | ||
) | ||
} | ||
|
||
export default ActionNetworkWidget |
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
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