/
Ad.tsx
37 lines (32 loc) · 990 Bytes
/
Ad.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as React from 'react';
import { loadScript } from 'utils/helpers';
import { Grid, createStyles, Theme, withStyles } from '@material-ui/core';
const styles = (theme: Theme) =>
createStyles({
'@global': {
'#codefund': {
'& .cf-wrapper': {
backgroundColor:
theme.palette.type === 'dark' ? theme.palette.background.paper + '! important' : 'auto',
},
'& .cf-text': {
color: theme.palette.text.primary + '! important',
},
},
},
});
const Ad: React.FunctionComponent = () => {
React.useEffect(() => {
const codefundScriptPosition = document.querySelector('#codefund-script-position');
if (codefundScriptPosition) {
loadScript('https://codefund.io/properties/197/funder.js', codefundScriptPosition);
}
}, []);
return (
<Grid container>
<span id="codefund-script-position" />
<div id="codefund" />
</Grid>
);
};
export default withStyles(styles)(Ad);