Mirror of https://github.com/roostorg/coop
github.com/roostorg/coop
1import React, { useEffect } from 'react';
2import { useLocation } from 'react-router-dom';
3
4export default function LegacyCSSProvider({
5 children,
6}: {
7 children: React.ReactNode;
8}) {
9 const { pathname } = useLocation();
10
11 useEffect(() => {
12 if (!pathname.startsWith('/dashboard')) {
13 const link = document.createElement('link');
14 link.rel = 'stylesheet';
15 link.href = '/styles/legacyStyles.css';
16 document.head.appendChild(link);
17
18 return () => {
19 document.head.removeChild(link);
20 };
21 }
22 }, [pathname]);
23
24 return <>{children}</>;
25}