mirror of
https://github.com/Sonarr/Sonarr.git
synced 2026-04-18 21:35:27 -04:00
a6e6b7518d
Fixed: Tooltips cutoff by edge of screen Closes #7705
23 lines
561 B
TypeScript
23 lines
561 B
TypeScript
import { useCallback, useEffect } from 'react';
|
|
import useTheme from 'Helpers/Hooks/useTheme';
|
|
import themes from 'Styles/Themes';
|
|
|
|
function ApplyTheme() {
|
|
const theme = useTheme();
|
|
|
|
const updateCSSVariables = useCallback(() => {
|
|
Object.entries(themes[theme]).forEach(([key, value]) => {
|
|
document.documentElement.style.setProperty(`--${key}`, value);
|
|
});
|
|
}, [theme]);
|
|
|
|
// On Component Mount and Component Update
|
|
useEffect(() => {
|
|
updateCSSVariables();
|
|
}, [updateCSSVariables, theme]);
|
|
|
|
return null;
|
|
}
|
|
|
|
export default ApplyTheme;
|