MCPcopy Create free account
hub / github.com/fontsource/fontsource / CarbonAd

Function CarbonAd

website/app/components/CarbonAd.tsx:9–30  ·  view source on GitHub ↗
({ ...props }: BoxProps)

Source from the content-addressed store, hash-verified

7import classes from './CarbonAd.module.css';
8
9export const CarbonAd = ({ ...props }: BoxProps) => {
10 const location = useLocation();
11
12 // We need to rerender the carbon ad when the route changes
13 // biome-ignore lint/correctness/useExhaustiveDependencies: Selective.
14 useEffect(() => {
15 const script = document.createElement('script');
16 script.src =
17 '//cdn.carbonads.com/carbon.js?serve=CEAI42QN&placement=fontsourceorg';
18 script.id = '_carbonads_js';
19 script.async = true;
20 document.querySelector('#carbonads')?.replaceWith(script);
21 }, [location]);
22
23 return (
24 <Box className={classes.wrapper} {...props}>
25 <Balancer>
26 <span id="carbonads" />
27 </Balancer>
28 </Box>
29 );
30};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected