Set "WhiteColors" as palette id for host palette if no id is provided (#395)
* Change files * Remove change file * Set "WhiteColors" as palette id if no id is provided * Change files * Create helper function for palette cache key
This commit is contained in:
Родитель
ff0babf4a8
Коммит
7ddc9af49d
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"type": "patch",
|
||||||
|
"comment": "Set \"WhiteColors\" as palette id if no id is provided",
|
||||||
|
"packageName": "@uifabricshared/theming-react-native",
|
||||||
|
"email": "krsiler@microsoft.com",
|
||||||
|
"dependentChangeType": "patch",
|
||||||
|
"date": "2020-08-13T00:25:28.785Z"
|
||||||
|
}
|
|
@ -32,8 +32,12 @@ function updatePaletteInCache(module: IOfficeThemingModule, cache: PaletteCache,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPaletteCacheKey = (palette?: string) => {
|
||||||
|
return useFakePalette ? 'debug' : palette || 'WhiteColors';
|
||||||
|
};
|
||||||
|
|
||||||
function translatePalette(module: IOfficeThemingModule, paletteCache: PaletteCache, palette?: string): IPartialPalette {
|
function translatePalette(module: IOfficeThemingModule, paletteCache: PaletteCache, palette?: string): IPartialPalette {
|
||||||
const key = useFakePalette ? 'debug' : palette || 'WhiteColors';
|
const key = getPaletteCacheKey(palette);
|
||||||
if (!paletteCache[key]) {
|
if (!paletteCache[key]) {
|
||||||
updatePaletteInCache(module, paletteCache, key);
|
updatePaletteInCache(module, paletteCache, key);
|
||||||
}
|
}
|
||||||
|
@ -52,7 +56,7 @@ export function translateOfficeTheme(module: IOfficeThemingModule, cache: Palett
|
||||||
},
|
},
|
||||||
typography: module.fluentTypography,
|
typography: module.fluentTypography,
|
||||||
host: {
|
host: {
|
||||||
palette: cache[id]
|
palette: cache[getPaletteCacheKey(id)]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче