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:
Krystal Siler 2020-08-14 10:39:51 -07:00 коммит произвёл GitHub
Родитель ff0babf4a8
Коммит 7ddc9af49d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -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 {
const key = useFakePalette ? 'debug' : palette || 'WhiteColors';
const key = getPaletteCacheKey(palette);
if (!paletteCache[key]) {
updatePaletteInCache(module, paletteCache, key);
}
@ -52,7 +56,7 @@ export function translateOfficeTheme(module: IOfficeThemingModule, cache: Palett
},
typography: module.fluentTypography,
host: {
palette: cache[id]
palette: cache[getPaletteCacheKey(id)]
}
};
}