|
|
@ -10,6 +10,7 @@ export interface RemixUiThemeModuleProps { |
|
|
|
|
|
|
|
|
|
|
|
export function RemixUiThemeModule({ themeModule }: RemixUiThemeModuleProps) { |
|
|
|
export function RemixUiThemeModule({ themeModule }: RemixUiThemeModuleProps) { |
|
|
|
const [themeName, setThemeName] = useState('') |
|
|
|
const [themeName, setThemeName] = useState('') |
|
|
|
|
|
|
|
const themeRef = useRef<any>(null) |
|
|
|
|
|
|
|
|
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
themeModule.switchTheme() |
|
|
|
themeModule.switchTheme() |
|
|
@ -20,22 +21,27 @@ export function RemixUiThemeModule({ themeModule }: RemixUiThemeModuleProps) { |
|
|
|
const linkRef = useRef<any>(null) |
|
|
|
const linkRef = useRef<any>(null) |
|
|
|
function initTheme (callback: () => void) { |
|
|
|
function initTheme (callback: () => void) { |
|
|
|
// const theme = yo`<link rel="stylesheet" href="${nextTheme.url}" id="theme-link"/>`
|
|
|
|
// const theme = yo`<link rel="stylesheet" href="${nextTheme.url}" id="theme-link"/>`
|
|
|
|
if (themeModule.active) { |
|
|
|
if (themeModule.active) { |
|
|
|
setNextTheme(themeModule.themes[themeModule.active]) // Theme
|
|
|
|
setNextTheme(themeModule.themes[themeModule.active]) // Theme
|
|
|
|
document.documentElement.style.setProperty('--theme', nextTheme.quality) |
|
|
|
document.documentElement.style.setProperty('--theme', nextTheme.quality) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
useEffect(() => { |
|
|
|
useEffect(() => { |
|
|
|
const shell = document.querySelector('div[data-id="remixIDE"]') as any |
|
|
|
const callback = () => { |
|
|
|
const splashScreen = document.querySelector('div[data-id="remixIDESplash"]') as Node |
|
|
|
setTimeout(() => { |
|
|
|
const callback = () => { |
|
|
|
document.body.removeChild(self._view.splashScreen) |
|
|
|
// setTimeout(() => {
|
|
|
|
self._view.el.style.visibility = 'visible' |
|
|
|
// document.body.removeChild(splashScreen)
|
|
|
|
}, 1500) |
|
|
|
// // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
|
|
addEventListener('load', () => { |
|
|
|
// shell!.style.visibility = 'visible'
|
|
|
|
|
|
|
|
// }, 1500)
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
document.addEventListener('load', () => { |
|
|
|
if (callback) callback() |
|
|
|
if (callback) callback() |
|
|
|
}) |
|
|
|
}) |
|
|
|
document.head.insertBefore(linkRef.current, document.head.firstChild) |
|
|
|
document.head.insertBefore(linkRef.current, document.head.firstChild) |
|
|
|
}, []) |
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<link rel="stylesheet" href={nextTheme.url} ref={linkRef} id="theme-link"/> |
|
|
|
<link rel="stylesheet" href={nextTheme.url} ref={linkRef} id="theme-link"/> |
|
|
|
) |
|
|
|
) |
|
|
|