Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 27 lines 652 B view raw
1import { useEffect, useState } from 'react'; 2 3const useDynamicLegacyCSS = (isUsingLegacyCSS: boolean) => { 4 const [cssLoaded, setCssLoaded] = useState(false); 5 6 useEffect(() => { 7 setCssLoaded(false); 8 9 if (isUsingLegacyCSS) { 10 const link = document.createElement('link'); 11 link.rel = 'stylesheet'; 12 link.href = '/styles/legacyStyles.css'; 13 link.onload = () => setCssLoaded(true); 14 document.head.appendChild(link); 15 16 return () => { 17 document.head.removeChild(link); 18 }; 19 } else { 20 setCssLoaded(true); 21 } 22 }, [isUsingLegacyCSS]); 23 24 return cssLoaded; 25}; 26 27export default useDynamicLegacyCSS;