mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-29 11:20:36 +01:00
fix(module): omit colors defined as strings
This commit is contained in:
@@ -191,7 +191,11 @@ const safelistComponentAliasesMap = {
|
|||||||
|
|
||||||
const colorsAsRegex = (colors: string[]): string => colors.join('|')
|
const colorsAsRegex = (colors: string[]): string => colors.join('|')
|
||||||
|
|
||||||
export const excludeColors = (colors: object) => Object.keys(omit(colors, colorsToExclude)).map(color => kebabCase(color)) as string[]
|
export const excludeColors = (colors: object): string[] => {
|
||||||
|
return Object.entries(omit(colors, colorsToExclude))
|
||||||
|
.filter(([, value]) => typeof value === 'object')
|
||||||
|
.map(([key]) => kebabCase(key))
|
||||||
|
}
|
||||||
|
|
||||||
export const generateSafelist = (colors: string[], globalColors) => {
|
export const generateSafelist = (colors: string[], globalColors) => {
|
||||||
const baseSafelist = Object.keys(safelistByComponent).flatMap(component => safelistByComponent[component](colorsAsRegex(colors)))
|
const baseSafelist = Object.keys(safelistByComponent).flatMap(component => safelistByComponent[component](colorsAsRegex(colors)))
|
||||||
|
|||||||
Reference in New Issue
Block a user