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
28 lines
673 B
TypeScript
28 lines
673 B
TypeScript
import { useSelector } from 'react-redux';
|
|
import { createSelector } from 'reselect';
|
|
import AppState from 'App/State/AppState';
|
|
import themes from 'Styles/Themes';
|
|
|
|
function createThemeSelector() {
|
|
return createSelector(
|
|
(state: AppState) => state.settings.ui.item.theme || window.Sonarr.theme,
|
|
(theme) => {
|
|
return theme;
|
|
}
|
|
);
|
|
}
|
|
|
|
const useTheme = () => {
|
|
return useSelector(createThemeSelector());
|
|
};
|
|
|
|
export default useTheme;
|
|
|
|
export const useThemeColor = (color: string) => {
|
|
const theme = useTheme();
|
|
const themeVariables = themes[theme];
|
|
|
|
// @ts-expect-error - themeVariables is a string indexable type
|
|
return themeVariables[color];
|
|
};
|