Skip to content

Commit

Permalink
Enhanced Inbox component to have dynamic svg icon from svg library (#…
Browse files Browse the repository at this point in the history
…1771)

* added population icon

* added logic to pick icon from svg-components in Inbox Screens

* Update micro-ui/web/micro-ui-internals/packages/react-components/src/atoms/InboxSearchLinks.js

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Update InboxSearchLinks.js

---------

Co-authored-by: Jagankumar <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent 2781ed3 commit 4e81618
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 19 deletions.
2 changes: 1 addition & 1 deletion micro-ui/web/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@egovernments/digit-ui-module-open-payment":"0.0.1",
"@egovernments/digit-ui-module-hrms": "1.8.1-beta.1",
"@egovernments/digit-ui-module-pgr": "1.8.1-beta.1",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"babel-loader": "8.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@egovernments/digit-ui-module-open-payment":"0.0.1",
"@egovernments/digit-ui-module-engagement": "1.5.20",
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"@egovernments/digit-ui-module-sandbox": "0.0.1",
"http-proxy-middleware": "^1.0.5",
"react": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/micro-ui-internals/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"lodash": "4.17.21",
"microbundle-crl": "0.13.11",
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "11.16.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-module-utilities":"1.0.1-beta.40",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"jsonpath": "^1.1.1",
"react": "17.0.2",
"react-date-range": "1.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"prepublish": "yarn build"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-hook-form": "6.15.8",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"@egovernments/digit-ui-components": "0.0.2-beta.18",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"lodash.merge": "^4.6.2",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react-router-dom": "5.3.0"
},
"dependencies": {
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"react": "17.0.2",
"react-date-range": "^1.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"dependencies": {
"@cyntler/react-doc-viewer": "1.10.3",
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"axios": "^1.7.2",
"react": "17.0.2",
"react-date-range": "^1.4.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"@rjsf/core": "5.10.0",
"@rjsf/utils": "5.10.0",
"@rjsf/validator-ajv8": "5.10.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@egovernments/digit-ui-react-components",
"version": "1.8.2-beta.17",
"version": "1.8.2-beta.18",
"license": "MIT",
"main": "dist/index.js",
"module": "dist/index.modern.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,36 @@ import React, { useState, useEffect } from "react"
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";

const getIconComponent = (iconName="")=>{
return require("@egovernments/digit-ui-react-components")?.[iconName];
}

const iconComponents = {};

const getIconComponent = (iconName = "") => {
if (typeof iconName !== "string") {
console.warn("Invalid iconName provided to getIconComponent");
return null;
}

// Return cached component if available
if (iconComponents[iconName]) {
return iconComponents[iconName];
}

try {
// Trying to get the icon from "digit-ui-react-components"
let IconComponent = require("@egovernments/digit-ui-react-components")?.[iconName];
// If the icon is not found, trying to get it from "digit-ui-svg-components"
if (!IconComponent) {
IconComponent = require("@egovernments/digit-ui-svg-components")?.[iconName];
}
// Cache the component
iconComponents[iconName] = IconComponent;
return IconComponent;
} catch (error) {
console.error(`Failed to load icon component: ${iconName}`, error);
return null;
}
};


const InboxSearchLinks = ({headerText, links, businessService, customClass="", logoIcon}) => {

Expand Down Expand Up @@ -39,4 +66,4 @@ const InboxSearchLinks = ({headerText, links, businessService, customClass="", l

}

export default InboxSearchLinks;
export default InboxSearchLinks;
2 changes: 1 addition & 1 deletion micro-ui/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"@egovernments/digit-ui-module-open-payment":"0.0.1",
"@egovernments/digit-ui-module-hrms": "1.8.1-beta.1",
"@egovernments/digit-ui-module-pgr": "1.8.1-beta.1",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"@egovernments/digit-ui-module-dss": "1.8.1",
"@egovernments/digit-ui-module-common": "1.8.0",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@egovernments/digit-ui-module-hrms": "1.8.1-beta.1",
"@egovernments/digit-ui-module-pgr": "1.8.1-beta.1",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.40",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"babel-loader": "8.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down
2 changes: 1 addition & 1 deletion micro-ui/web/workbench/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@egovernments/digit-ui-components": "0.0.2-beta.48",
"@egovernments/digit-ui-module-core": "1.8.2-beta.25",
"@egovernments/digit-ui-module-utilities": "1.0.1-beta.40",
"@egovernments/digit-ui-react-components": "1.8.2-beta.17",
"@egovernments/digit-ui-react-components": "1.8.2-beta.18",
"babel-loader": "8.1.0",
"react": "17.0.2",
"react-dom": "17.0.2",
Expand Down

0 comments on commit 4e81618

Please sign in to comment.