mirror of
https://github.com/strapi/strapi.git
synced 2025-09-26 08:52:26 +00:00
Remove bootstrap when unmounting ctb
Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
parent
4b404f43f6
commit
7d718c7583
@ -1,4 +1,4 @@
|
|||||||
import React from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { ThemeProvider } from 'styled-components';
|
import { ThemeProvider } from 'styled-components';
|
||||||
import 'bootstrap/dist/css/bootstrap.css';
|
import 'bootstrap/dist/css/bootstrap.css';
|
||||||
|
|
||||||
@ -92,6 +92,21 @@ const theme = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line react/prop-types
|
// eslint-disable-next-line react/prop-types
|
||||||
const TempTP = ({ children }) => <ThemeProvider theme={theme}>{children}</ThemeProvider>;
|
const TempTP = ({ children }) => {
|
||||||
|
// FIXME:
|
||||||
|
// temporary hack to remove bootstrap css
|
||||||
|
// tested on chrome, safari and firefox it seems to be working...
|
||||||
|
useEffect(() => {
|
||||||
|
return () => {
|
||||||
|
const targetelement = 'style';
|
||||||
|
|
||||||
|
const allsuspects = document.getElementsByTagName(targetelement);
|
||||||
|
|
||||||
|
document.getElementsByTagName('head')[0].removeChild(allsuspects[allsuspects.length - 1]);
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
|
||||||
|
};
|
||||||
|
|
||||||
export default TempTP;
|
export default TempTP;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user