Skip to content

Commit 15690b7

Browse files
committed
fixup! feat!: Paragon 23 and External CSS support
1 parent 0c7e11a commit 15690b7

File tree

5 files changed

+24
-8
lines changed

5 files changed

+24
-8
lines changed

docs/how_tos/theming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ with the following:
8787
| `variants.light` | Object | Metadata about the theme's light variant styles. |
8888
| `variants.light.url` | String | URL for the theme's light variant stylesheet. |
8989
| `variants.dark` | Object | Metadata about the theme's dark variant styles. |
90-
| `variants.dark.url` | String | URL for the theme's dark variant styles. |
90+
| `variants.dark.url` | String | URL for the theme's dark variant stylesheet. |
9191

9292
The `dark` theme variant is optional.
9393

runtime/react/hooks/theme/useThemeConfig.test.ts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ describe('useThemeConfig', () => {
2424
});
2525

2626
describe('when `siteConfig.theme` is present', () => {
27-
it('returns empty object if at least one variant is not defined', () => {
27+
it('returns empty object if core is not defined and no variants are defined', () => {
2828
jest.spyOn(config, 'getSiteConfig').mockReturnValue({
2929
...baseSiteConfig,
3030
theme: {
@@ -35,7 +35,25 @@ describe('useThemeConfig', () => {
3535
const { result } = renderHook(() => useThemeConfig());
3636
expect(result.current).toStrictEqual({});
3737
});
38-
it('returns expected object when nothing but the light variant is defined', () => {
38+
it('returns expected object when only core is defined', () => {
39+
jest.spyOn(config, 'getSiteConfig').mockReturnValue({
40+
...baseSiteConfig,
41+
theme: {
42+
core: {
43+
url: 'core.css',
44+
},
45+
},
46+
});
47+
const { result } = renderHook(() => useThemeConfig());
48+
expect(result.current).toStrictEqual({
49+
core: {
50+
url: 'core.css',
51+
},
52+
defaults: undefined,
53+
variants: undefined,
54+
});
55+
});
56+
it('returns expected object when only a light variant is defined', () => {
3957
jest.spyOn(config, 'getSiteConfig').mockReturnValue({
4058
...baseSiteConfig,
4159
theme: {
@@ -53,7 +71,6 @@ describe('useThemeConfig', () => {
5371
}
5472
});
5573
});
56-
5774
it('returns expected object when configuration is valid', () => {
5875
jest.spyOn(config, 'getSiteConfig').mockReturnValue({
5976
...baseSiteConfig,

runtime/react/hooks/theme/useThemeConfig.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import { isEmptyObject } from './utils';
1313
*
1414
* const themeConfig = useThemeConfig();
1515
* if (themeConfig) {
16-
* console.log(themeConfig.core.url); // Outputs the URL of the brand theme CSS
17-
* console.log(themeConfig.variants['dark'].url); // Outputs the URL of the dark theme variant CSS
16+
* console.log(themeConfig.core.url); // Outputs the URL of theme's core CSS
17+
* console.log(themeConfig.variants['dark'].url); // Outputs the URL of the theme's dark variant CSS
1818
* }
1919
*/
2020
const useThemeConfig = (): Theme => useMemo(() => {

runtime/react/hooks/theme/useThemeVariants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const useThemeVariants = ({
7474

7575
// Iterate over each theme variant URLs and inject them into the HTML document, if each doesn't already exist.
7676
Object.entries(themeVariants).forEach(([themeVariant, { url }]) => {
77-
// If there is no config for the theme variant URL, set the theme variant to complete and continue.
77+
// If the config for the theme variant does not have a URL, set the variant to complete and continue.
7878
if (!url) {
7979
setIsThemeVariantComplete(true);
8080
return;

runtime/testing/mockMessages.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const messages = {
1818
ru: {},
1919
th: {},
2020
uk: {},
21-
vi: {},
2221
};
2322

2423
export default messages;

0 commit comments

Comments
 (0)