@dbcdk/react-components 0.0.179 → 0.0.180
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -108,15 +108,16 @@ instead of `useTheme()`:
|
|
|
108
108
|
import { useGetActiveTheme } from '@dbcdk/react-components/client'
|
|
109
109
|
|
|
110
110
|
export function ThemeBadge() {
|
|
111
|
-
const { theme, colorScheme } = useGetActiveTheme()
|
|
111
|
+
const { theme, colorScheme, themeKey } = useGetActiveTheme()
|
|
112
112
|
|
|
113
|
-
return <span>{theme} / {colorScheme}</span>
|
|
113
|
+
return <span>{themeKey ?? `${theme} / ${colorScheme}`}</span>
|
|
114
114
|
}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
`useGetActiveTheme()` is intentionally read-only and takes no options. It
|
|
118
118
|
reports the current active theme state as established by `ThemeScript`,
|
|
119
|
-
persisted storage, or another mounted theme control.
|
|
119
|
+
persisted storage, or another mounted theme control. `themeKey` is only set
|
|
120
|
+
when both `theme` and `colorScheme` are resolved, and is otherwise `null`.
|
|
120
121
|
|
|
121
122
|
---
|
|
122
123
|
|
|
@@ -7,7 +7,8 @@ var useTheme = require('./useTheme');
|
|
|
7
7
|
function useGetActiveTheme() {
|
|
8
8
|
const { theme } = useTheme.useTheme();
|
|
9
9
|
const { colorScheme } = useColorScheme.useColorScheme();
|
|
10
|
-
|
|
10
|
+
const themeKey = theme && colorScheme ? `${theme}-${colorScheme}` : null;
|
|
11
|
+
return { theme, colorScheme, themeKey };
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
exports.useGetActiveTheme = useGetActiveTheme;
|
|
@@ -5,7 +5,8 @@ import { useTheme } from './useTheme';
|
|
|
5
5
|
function useGetActiveTheme() {
|
|
6
6
|
const { theme } = useTheme();
|
|
7
7
|
const { colorScheme } = useColorScheme();
|
|
8
|
-
|
|
8
|
+
const themeKey = theme && colorScheme ? `${theme}-${colorScheme}` : null;
|
|
9
|
+
return { theme, colorScheme, themeKey };
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export { useGetActiveTheme };
|