Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(icon-build-helpers): support glyph-only assets #8724

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/icon-build-helpers/src/builders/react/next.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,10 @@ function createIconSource(moduleName, sizes, preamble = []) {
});

// The "default" icon that will be rendered, based on the max size
const returnStatement = sizeVariants.find(({ size }) => {
return size === maxSize;
});
const returnStatement =
sizeVariants.find(({ size }) => {
return size === maxSize;
}) ?? sizeVariants[0];

// We build up our component source by adding in any necessary deprecation
// blocks along with conditionally rendering all asset sizes. We also use a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ const output = (options = defaultOptions) => {

// If the target is not set to pictograms, then we're building up
// metadata for icons
const defaultAsset = icon.assets.find(
(asset) => asset.size === defaultSize
);
const defaultAsset =
icon.assets.find((asset) => asset.size === defaultSize) ??
icon.assets[0];
icon.output = await Promise.all(
sizes.map(async (size) => {
const asset = icon.assets.find((asset) => asset.size === size);
Expand Down