From f5665ede706a460e52c5a371bf562f7dbfe37729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joaqu=C3=ADn=20S=C3=A1nchez=20Jim=C3=A9nez?= Date: Sat, 26 Feb 2022 16:27:20 +0100 Subject: [PATCH] chore: handle `scale` option when merging svg icon props --- packages/utils/src/loader/custom.ts | 1 + packages/utils/src/loader/modern.ts | 1 + packages/utils/src/loader/utils.ts | 8 ++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/utils/src/loader/custom.ts b/packages/utils/src/loader/custom.ts index 6037e8a..10c820f 100644 --- a/packages/utils/src/loader/custom.ts +++ b/packages/utils/src/loader/custom.ts @@ -41,6 +41,7 @@ export async function getCustomIcon( collection, icon, additionalProps, + options?.scale ?? 1.2, undefined, iconCustomizer, ); diff --git a/packages/utils/src/loader/modern.ts b/packages/utils/src/loader/modern.ts index 083541b..7913d27 100644 --- a/packages/utils/src/loader/modern.ts +++ b/packages/utils/src/loader/modern.ts @@ -37,6 +37,7 @@ export async function searchForIcon( collection, id, additionalProps, + options?.scale ?? 1.2, () => attributes, iconCustomizer ); diff --git a/packages/utils/src/loader/utils.ts b/packages/utils/src/loader/utils.ts index 426d2f2..21dbbe4 100644 --- a/packages/utils/src/loader/utils.ts +++ b/packages/utils/src/loader/utils.ts @@ -8,10 +8,14 @@ export async function mergeIconProps( collection: string, icon: string, additionalProps: Record, + scale: number, propsProvider?: () => Awaitable>, - iconCustomizer?: IconCustomizer + iconCustomizer?: IconCustomizer, ): Promise { - const props: Record = (await propsProvider?.()) ?? {}; + const props: Record = (await propsProvider?.()) ?? { + height: `${scale ?? 1}em`, + width: `${scale ?? 1}em`, + }; await iconCustomizer?.(collection, icon, props); Object.keys(additionalProps).forEach((p) => { const v = additionalProps[p];