You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: simplify fallback of ui icon size numbers (#3571)
* feat(icon): simplify fallback of ui icon size numbers
If a UI icon was not provided with its full name including sizing number
(e.g. Dash100), the template would try and guess at a sizing number
based on t-shirt size. This has been extracted out to a utility
function and simplified, as this had gotten too complex, with too many
exceptions. It no longer strips out any sizing numbers that were
specifically provided. This also improves the logging of missing icons.
* feat(icon): display placeholder icon when workflow icon is missing
Display the design recommended "Circle" icon as a placeholder icon
when the workflow icon cannot be found.This helps with identifying
missing icons in VRTs, so the icon continues to take up the space it
should, rather than disappearing entirely in some cases.
This change also updates the templates of a few components to make
sure they are rendering the correct UI icon:
- fix(menu): update ui icon sizes used in template
- docs(button): replace deprecated ui icon size in test
- feat(swatch): use spec defined ui icon size number for dash
- fix: icon set arg was missing a value in a few places
- fix(actionbutton): define specific sizing for corner triangle
- fix(menu): add missing context to menu templates to fix warning
console.warn(`Using fallback UI Icon sizing number "${sizeVal}" for "${idKey}". UI icon size was not provided or does not exist in the list of available UI icons.`);
console.warn(`Icon: Could not render the correct icon with the name "${iconName}" because it does not exist in the "workflow" icon set. Rendering the placeholder icon instead.`);
85
+
iconName="Circle";
86
+
}
153
87
154
-
iconName=iconName.replace(/\d{2,3}$/,"");
155
-
iconName+=sizeVal;
88
+
// Name of icon that corresponds with SVG file. This may differ from the icon name, such as with
89
+
// directional icons that use a single icon.
90
+
leticonNameToLoad=iconName;
156
91
157
-
if(!uiIconsCleaned.includes(idKey)){
158
-
console.error(`The UI icon "${idKey}" does not exist in the list of available UI icons.`);
159
-
}
92
+
// If a descriptor like "Right", "Left", "Down", or "Up" is present for the UI icons Chevron or
93
+
// Arrow, use that only for the class name and not the icon fetch. This is because these use a
console.warn(`Could not find SVG markup for "${idKey}" in context.loaded.icons. Did you pass through context? Falling back to using the sprite sheet reference instead.`);
137
+
console.warn(`Could not find SVG markup for "${iconNameToLoad}" in context.loaded.icons. Was context passed through in the template? Falling back to using the sprite sheet reference instead.`);
198
138
}
199
139
}
200
140
201
141
// ID of the icon within the sprite sheet for its icon set.
0 commit comments