Skip to content

Commit

Permalink
fix: sync changes from v2 to v2-develop (#789) [skip ci]
Browse files Browse the repository at this point in the history
Co-authored-by: mguellsegarra <5711443+mguellsegarra@users.noreply.github.com>
  • Loading branch information
giscegit and mguellsegarra authored Dec 20, 2024
1 parent a184f58 commit 0d09dd4
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@gisce/react-ooui",
"version": "2.51.1",
"version": "2.51.2",
"engines": {
"node": "20.5.0"
},
Expand Down
20 changes: 16 additions & 4 deletions src/helpers/iconMapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ export default (
key = `STOCK_${rootIcon.toUpperCase()}`;
}

// eslint-disable-next-line no-prototype-builtins
if (iconMapping.hasOwnProperty(key)) {
return getIconForKey(iconMapping[key], props);
}
Expand All @@ -132,13 +133,14 @@ function getIconForKey(
key: string,
props?: { className?: any; style: CSSProperties },
) {
let IconCamelCase = key.charAt(0).toUpperCase() + key.slice(1); // Capitalize first letter
let IconCamelCase = key.charAt(0).toUpperCase() + key.slice(1);
if (IconCamelCase.indexOf("-") !== -1) {
IconCamelCase = toCamelCase(IconCamelCase);
}

const antKey: AntKey = `${IconCamelCase}Outlined` as any;
if (AntIcons[antKey]) {
// eslint-disable-next-line react/display-name
return () =>
React.createElement(AntIcons[antKey] as any, {
...props,
Expand All @@ -150,12 +152,22 @@ function getIconForKey(
const TablerIcon = () =>
React.createElement(TablerIcons[tablerKey] as any, {
fill: "transparent",
// eslint-disable-next-line react/prop-types
size: props?.style?.fontSize || 17,
});
const CustomIcon = () =>
React.createElement(Icon, {
component: TablerIcon,
...props,
// eslint-disable-next-line react/no-children-prop
React.createElement("span", {
style: {
display: "inline-flex",
alignItems: "center",
lineHeight: "1",
verticalAlign: "middle",
},
children: React.createElement(Icon, {
component: TablerIcon,
...props,
}),
});
return CustomIcon;
}
Expand Down

0 comments on commit 0d09dd4

Please sign in to comment.