mirror of
https://github.com/Sonarr/Sonarr
synced 2026-05-05 11:30:51 +02:00
Theme specific metadata source images
This commit is contained in:
parent
cd1aeefc4f
commit
15c6fa8f0e
5 changed files with 14 additions and 3 deletions
BIN
frontend/src/Content/Images/thetvdb-dark.png
Normal file
BIN
frontend/src/Content/Images/thetvdb-dark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.9 KiB |
BIN
frontend/src/Content/Images/thetvdb-light.png
Normal file
BIN
frontend/src/Content/Images/thetvdb-light.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 14 KiB |
|
|
@ -2,10 +2,18 @@ import { useEffect, useState } from 'react';
|
|||
import { useUiSettingsValues } from 'Settings/UI/useUiSettings';
|
||||
import themes from 'Styles/Themes';
|
||||
|
||||
const useTheme = () => {
|
||||
const useTheme = (): 'dark' | 'light' => {
|
||||
const { theme } = useUiSettingsValues();
|
||||
const selectedTheme = theme ?? window.Sonarr.theme;
|
||||
const [resolvedTheme, setResolvedTheme] = useState(selectedTheme);
|
||||
const [resolvedTheme, setResolvedTheme] = useState(() => {
|
||||
if (selectedTheme === 'auto') {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
? 'dark'
|
||||
: 'light';
|
||||
}
|
||||
|
||||
return selectedTheme;
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedTheme !== 'auto') {
|
||||
|
|
|
|||
|
|
@ -1,14 +1,17 @@
|
|||
import React from 'react';
|
||||
import InlineMarkdown from 'Components/Markdown/InlineMarkdown';
|
||||
import useTheme from 'Helpers/Hooks/useTheme';
|
||||
import translate from 'Utilities/String/translate';
|
||||
import styles from './TheTvdb.css';
|
||||
|
||||
function TheTvdb() {
|
||||
const theme = useTheme();
|
||||
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<img
|
||||
className={styles.image}
|
||||
src={`${window.Sonarr.urlBase}/Content/Images/thetvdb.png`}
|
||||
src={`${window.Sonarr.urlBase}/Content/Images/thetvdb-${theme}.png`}
|
||||
/>
|
||||
|
||||
<div className={styles.info}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue