From 8a9426a145e523cc0a885163b2bcb1747b35cb3c Mon Sep 17 00:00:00 2001 From: Manjila Singh Date: Mon, 16 Dec 2024 20:38:06 +0000 Subject: [PATCH 1/7] Added DiscoverNSF.js --- src/components/DiscoverNSF.js | 74 +++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/components/DiscoverNSF.js diff --git a/src/components/DiscoverNSF.js b/src/components/DiscoverNSF.js new file mode 100644 index 0000000..d582b56 --- /dev/null +++ b/src/components/DiscoverNSF.js @@ -0,0 +1,74 @@ +import React, { useEffect } from 'react'; + +const DiscoverNSF = () => { + useEffect(() => { + // Load Bootstrap Icons stylesheet + const link = document.createElement('link'); + link.rel = 'stylesheet'; + link.href = 'https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css'; + document.head.appendChild(link); + + // Create the div for the NSF Resource Catalog + const resourceCatalogDiv = document.createElement('div'); + resourceCatalogDiv.id = 'resource-catalog-react'; + document.body.appendChild(resourceCatalogDiv); + + // Dynamically import and initialize the script + const loadScript = async () => { + const baseUrl = 'https://esm.sh/@xras/ui@onramps_v1/dist'; + const { onRampsResourceCatalog, shadowTarget } = await import( + 'https://esm.sh/@xras/ui@onramps_v1/dist/xras-ui.js' + ); + + onRampsResourceCatalog({ + target: shadowTarget( + document.getElementById('resource-catalog-react'), + { accessStyles: true, baseUrl } + ), + onRamps: true, + baseUrl, + }); + + setTimeout(() => { + const shadowHost = document.getElementById('resource-catalog-react'); + const shadowRoot = shadowHost.shadowRoot; + + if (shadowRoot) { + // Query inside shadowRoot for the badges + const badges = shadowRoot.querySelectorAll('.badge'); + + badges.forEach((badge) => { + // Remove the 'text-bg-secondary' class if it exists + badge.classList.remove('text-bg-secondary'); + + // Apply inline styles for color and background + badge.style.color = 'black'; // Set text color to black + badge.style.backgroundColor = 'white'; // Clear any background color + }); + + // Also, check and modify the bootstrap-fonts element's data-bs-theme + const element = shadowRoot.querySelector('.bootstrap-fonts'); + if (element) { + element.setAttribute('data-bs-theme', ''); // Remove theme if needed + } else { + console.log('Element not found in shadow root'); + } + } else { + console.log('Shadow root not found'); + } + }, 500); + }; + + loadScript(); + + // Cleanup function to remove elements when component unmounts + return () => { + document.head.removeChild(link); + document.body.removeChild(resourceCatalogDiv); + }; + }, []); + + return
; +}; + +export default DiscoverNSF; From ef6049a2b7b0618af7938524e31aaf8626e95738 Mon Sep 17 00:00:00 2001 From: Manjila Singh Date: Mon, 16 Dec 2024 20:38:36 +0000 Subject: [PATCH 2/7] Added discover NSF access resources page --- .../external-resources/nsf-access/explore.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 docs/services/external-resources/nsf-access/explore.md diff --git a/docs/services/external-resources/nsf-access/explore.md b/docs/services/external-resources/nsf-access/explore.md new file mode 100644 index 0000000..7163947 --- /dev/null +++ b/docs/services/external-resources/nsf-access/explore.md @@ -0,0 +1,14 @@ +--- +sidebar_position: 2 +title: "Discover NSF ACCESS resources" +description: "Explore NSF resources" +tags: + - NSF + - resources +--- + + + +import DiscoverNSF from '@site/src/components/DiscoverNSF'; + + From 49d7b8a77ff5f6bc02eb4e39965c46483c06d608 Mon Sep 17 00:00:00 2001 From: Manjila Singh Date: Tue, 17 Dec 2024 16:45:19 +0000 Subject: [PATCH 3/7] Fixed build error --- package-lock.json | 356 +++++++++++++++++++++++++++++++++- package.json | 1 + src/components/DiscoverNSF.js | 4 +- 3 files changed, 352 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 286ffd7..3d2e0c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "@emotion/styled": "^11.11.0", "@mdx-js/react": "^3.0.0", "@mui/material": "^5.14.19", + "@xras/ui": "^0.5.3", "clsx": "^2.0.0", "docusaurus": "^1.14.7", "docusaurus-lunr-search": "^3.4.0", @@ -4684,6 +4685,102 @@ "url": "https://opencollective.com/popperjs" } }, + "node_modules/@react-aria/ssr": { + "version": "3.9.7", + "resolved": "https://registry.npmjs.org/@react-aria/ssr/-/ssr-3.9.7.tgz", + "integrity": "sha512-GQygZaGlmYjmYM+tiNBA5C6acmiDWF52Nqd40bBp0Znk4M4hP+LTmI0lpI1BuKMw45T8RIhrAsICIfKwZvi2Gg==", + "dependencies": { + "@swc/helpers": "^0.5.0" + }, + "engines": { + "node": ">= 12" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1" + } + }, + "node_modules/@reduxjs/toolkit": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@reduxjs/toolkit/-/toolkit-2.5.0.tgz", + "integrity": "sha512-awNe2oTodsZ6LmRqmkFhtb/KH03hUhxOamEQy411m3Njj3BbFvoBovxo4Q1cBWnV1ErprVj9MlF0UPXkng0eyg==", + "dependencies": { + "immer": "^10.0.3", + "redux": "^5.0.1", + "redux-thunk": "^3.1.0", + "reselect": "^5.1.0" + }, + "peerDependencies": { + "react": "^16.9.0 || ^17.0.0 || ^18 || ^19", + "react-redux": "^7.2.1 || ^8.1.3 || ^9.0.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-redux": { + "optional": true + } + } + }, + "node_modules/@reduxjs/toolkit/node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, + "node_modules/@restart/hooks": { + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.16.tgz", + "integrity": "sha512-f7aCv7c+nU/3mF7NWLtVVr0Ra80RqsO89hO72r+Y/nvQr5+q0UFGkocElTH6MJApvReVh6JHUFYn2cw1WdHF3w==", + "dependencies": { + "dequal": "^2.0.3" + }, + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@restart/ui": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/@restart/ui/-/ui-1.9.2.tgz", + "integrity": "sha512-MWWqJqSyqUWWPBOOiRQrX57CBc/9CoYONg7sE+uag72GCAuYrHGU5c49vU5s4BUSBgiKNY6rL7TULqGDrouUaA==", + "dependencies": { + "@babel/runtime": "^7.26.0", + "@popperjs/core": "^2.11.8", + "@react-aria/ssr": "^3.5.0", + "@restart/hooks": "^0.5.0", + "@types/warning": "^3.0.3", + "dequal": "^2.0.3", + "dom-helpers": "^5.2.0", + "uncontrollable": "^8.0.4", + "warning": "^4.0.3" + }, + "peerDependencies": { + "react": ">=16.14.0", + "react-dom": ">=16.14.0" + } + }, + "node_modules/@restart/ui/node_modules/@restart/hooks": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.5.0.tgz", + "integrity": "sha512-wS+h6IusJCPjTkmOOrRZxIPICD/mtFA3PRZviutoM23/b7akyDGfZF/WS+nIFk27u7JDhPE2+0GBdZxjSqHZkg==", + "dependencies": { + "dequal": "^2.0.3" + }, + "peerDependencies": { + "react": ">=16.8.0" + } + }, + "node_modules/@restart/ui/node_modules/uncontrollable": { + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-8.0.4.tgz", + "integrity": "sha512-ulRWYWHvscPFc0QQXvyJjY6LIXU56f0h8pQFvhxiKk5V1fcI8gp9Ht9leVAhrVjzqMw0BgjspBINx9r6oyJUvQ==", + "peerDependencies": { + "react": ">=16.14.0" + } + }, "node_modules/@sideway/address": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz", @@ -5021,6 +5118,14 @@ "url": "https://github.com/sponsors/gregberge" } }, + "node_modules/@swc/helpers": { + "version": "0.5.15", + "resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz", + "integrity": "sha512-JQ5TuMi45Owi4/BIMAJBoSQoOJu12oOk/gADqlcUL9JEdHB8vyjUSsxqeNXnmXHjYKMi2WcYtezGEEhqUI/E2g==", + "dependencies": { + "tslib": "^2.8.0" + } + }, "node_modules/@szmarczak/http-timer": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-5.0.1.tgz", @@ -5276,9 +5381,9 @@ "integrity": "sha512-A0D0aTXvjlqJ5ZILMz3rNfDBOx9hHxLZYv2by47Sm/pqW35zzjusrZTryatjN/Rf8Us2gZrJD+KeHbUSTux1Cw==" }, "node_modules/@types/prop-types": { - "version": "15.7.11", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", - "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==" + "version": "15.7.14", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.14.tgz", + "integrity": "sha512-gNMvNH49DJ7OJYv+KAKn0Xp45p8PLl6zo2YnvDIbTd4J6MER2BmWN49TG7n9LvkyihINxeKW8+3bfS2yDC9dzQ==" }, "node_modules/@types/q": { "version": "1.5.8", @@ -5400,6 +5505,16 @@ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" }, + "node_modules/@types/use-sync-external-store": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.6.tgz", + "integrity": "sha512-zFDAD+tlpf2r4asuHEj0XH6pY6i0g5NeAHPn+15wk3BV6JA69eERFXC1gyGThDkVa1zCyKr5jox1+2LbV/AMLg==" + }, + "node_modules/@types/warning": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/warning/-/warning-3.0.3.tgz", + "integrity": "sha512-D1XC7WK8K+zZEveUPY+cf4+kgauk8N4eHr/XIHXGlGYkHLud6hK9lYfZk1ry1TNh798cZUCgb6MqGEG8DkJt6Q==" + }, "node_modules/@types/ws": { "version": "8.5.13", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.13.tgz", @@ -5557,6 +5672,31 @@ "@xtuc/long": "4.2.2" } }, + "node_modules/@xras/ui": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@xras/ui/-/ui-0.5.3.tgz", + "integrity": "sha512-tRfVSBw5QVY7wpFoI4dhi9Z5Z+4vAPjlh/AP5OuBiqygrBlMmkCmP88qFzDm/areLDwHkUpjuMLaQVthnYSdkw==", + "dependencies": { + "@reduxjs/toolkit": "^2.1.0", + "bootstrap": "^5.3.3", + "immer": "^10.0.3", + "react": "^18.2.0", + "react-bootstrap": "^2.10.0", + "react-dom": "^18.2.0", + "react-redux": "^9.1.0", + "react-select": "^5.8.0", + "sanitize-html": "^2.13.0" + } + }, + "node_modules/@xras/ui/node_modules/immer": { + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/immer/-/immer-10.1.1.tgz", + "integrity": "sha512-s2MPrmjovJcoMaHtx6K11Ra7oD05NT97w1IC5zpMkT6Atjr7H8LjaDd81iIxUYpMKSRRNMJE703M1Fhr/TctHw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/immer" + } + }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz", @@ -9352,6 +9492,24 @@ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==" }, + "node_modules/bootstrap": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-5.3.3.tgz", + "integrity": "sha512-8HLCdWgyoMguSO9o+aH+iuZ+aht+mzW0u3HIMzVu7Srrpv7EBBxTnrFlSCskwdY1+EOFQSm7uMJhNQHkdPcmjg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/twbs" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/bootstrap" + } + ], + "peerDependencies": { + "@popperjs/core": "^2.11.8" + } + }, "node_modules/boxen": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/boxen/-/boxen-6.2.1.tgz", @@ -25368,6 +25526,11 @@ "node": ">=0.10.0" } }, + "node_modules/parse-srcset": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/parse-srcset/-/parse-srcset-1.0.2.tgz", + "integrity": "sha512-/2qh0lav6CmI15FzA3i/2Bzk2zCgQhGMkvhOhKNcBVQ1ldgpbfiNTVslmooUmWJcADi1f1kIeynbDRVzNlfR6Q==" + }, "node_modules/parse5": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", @@ -27432,6 +27595,23 @@ "reflect.ownkeys": "^0.2.0" } }, + "node_modules/prop-types-extra": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/prop-types-extra/-/prop-types-extra-1.1.1.tgz", + "integrity": "sha512-59+AHNnHYCdiC+vMwY52WmvP5dM3QLeoumYuEyceQDi9aEhtwN9zIQ2ZNo25sMyXnbh32h+P1ezDsUpUH3JAew==", + "dependencies": { + "react-is": "^16.3.2", + "warning": "^4.0.0" + }, + "peerDependencies": { + "react": ">=0.14.0" + } + }, + "node_modules/prop-types-extra/node_modules/react-is": { + "version": "16.13.1", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", + "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" + }, "node_modules/prop-types/node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", @@ -28038,6 +28218,36 @@ "node": ">=0.10.0" } }, + "node_modules/react-bootstrap": { + "version": "2.10.7", + "resolved": "https://registry.npmjs.org/react-bootstrap/-/react-bootstrap-2.10.7.tgz", + "integrity": "sha512-w6mWb3uytB5A18S2oTZpYghcOUK30neMBBvZ/bEfA+WIF2dF4OGqjzoFVMpVXBjtyf92gkmRToHlddiMAVhQqQ==", + "dependencies": { + "@babel/runtime": "^7.24.7", + "@restart/hooks": "^0.4.9", + "@restart/ui": "^1.9.2", + "@types/prop-types": "^15.7.12", + "@types/react-transition-group": "^4.4.6", + "classnames": "^2.3.2", + "dom-helpers": "^5.2.1", + "invariant": "^2.2.4", + "prop-types": "^15.8.1", + "prop-types-extra": "^1.1.0", + "react-transition-group": "^4.4.5", + "uncontrollable": "^7.2.1", + "warning": "^4.0.3" + }, + "peerDependencies": { + "@types/react": ">=16.14.8", + "react": ">=16.14.0", + "react-dom": ">=16.14.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/react-dev-utils": { "version": "12.0.1", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz", @@ -28275,6 +28485,11 @@ "react": "^16.13.1 || ^17.0.0 || ^18.0.0" } }, + "node_modules/react-lifecycles-compat": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz", + "integrity": "sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==" + }, "node_modules/react-loadable": { "name": "@docusaurus/react-loadable", "version": "6.0.0", @@ -28342,6 +28557,28 @@ "react": ">=16.6.0" } }, + "node_modules/react-redux": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz", + "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==", + "dependencies": { + "@types/use-sync-external-store": "^0.0.6", + "use-sync-external-store": "^1.4.0" + }, + "peerDependencies": { + "@types/react": "^18.2.25 || ^19", + "react": "^18.0 || ^19", + "redux": "^5.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + }, + "redux": { + "optional": true + } + } + }, "node_modules/react-responsive-carousel": { "version": "3.2.23", "resolved": "https://registry.npmjs.org/react-responsive-carousel/-/react-responsive-carousel-3.2.23.tgz", @@ -28418,6 +28655,31 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==" }, + "node_modules/react-select": { + "version": "5.9.0", + "resolved": "https://registry.npmjs.org/react-select/-/react-select-5.9.0.tgz", + "integrity": "sha512-nwRKGanVHGjdccsnzhFte/PULziueZxGD8LL2WojON78Mvnq7LdAMEtu2frrwld1fr3geixg3iiMBIc/LLAZpw==", + "dependencies": { + "@babel/runtime": "^7.12.0", + "@emotion/cache": "^11.4.0", + "@emotion/react": "^11.8.1", + "@floating-ui/dom": "^1.0.1", + "@types/react-transition-group": "^4.4.0", + "memoize-one": "^6.0.0", + "prop-types": "^15.6.0", + "react-transition-group": "^4.3.0", + "use-isomorphic-layout-effect": "^1.2.0" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/react-select/node_modules/memoize-one": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/memoize-one/-/memoize-one-6.0.0.tgz", + "integrity": "sha512-rkpe71W0N0c0Xz6QD0eJETuWAJGnJ9afsl1srmwPrI+yBCkge5EycXXbYRyvL29zZVUWQCY7InPRCv3GDXuZNw==" + }, "node_modules/react-transition-group": { "version": "4.4.5", "resolved": "https://registry.npmjs.org/react-transition-group/-/react-transition-group-4.4.5.tgz", @@ -28682,6 +28944,19 @@ "node": ">=0.10.0" } }, + "node_modules/redux": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", + "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==" + }, + "node_modules/redux-thunk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/redux-thunk/-/redux-thunk-3.1.0.tgz", + "integrity": "sha512-NW2r5T6ksUKXCabzhL9z+h206HQw/NJkcLm1GPImRQ8IzfXwRGqjVhKJGauHirT0DAuyy6hjdnMZaRoAcy0Klw==", + "peerDependencies": { + "redux": "^5.0.0" + } + }, "node_modules/reflect.ownkeys": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz", @@ -29457,6 +29732,11 @@ "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" }, + "node_modules/reselect": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/reselect/-/reselect-5.1.1.tgz", + "integrity": "sha512-K/BG6eIky/SBpzfHZv/dd+9JBFiS4SWV7FIujVyJRux6e45+73RaUHXLmIR1f7WOMaQ0U1km6qwklRQxpJJY0w==" + }, "node_modules/resolve": { "version": "1.22.8", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", @@ -30010,6 +30290,27 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, + "node_modules/sanitize-html": { + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/sanitize-html/-/sanitize-html-2.13.1.tgz", + "integrity": "sha512-ZXtKq89oue4RP7abL9wp/9URJcqQNABB5GGJ2acW1sdO8JTVl92f4ygD7Yc9Ze09VAZhnt2zegeU0tbNsdcLYg==", + "dependencies": { + "deepmerge": "^4.2.2", + "escape-string-regexp": "^4.0.0", + "htmlparser2": "^8.0.0", + "is-plain-object": "^5.0.0", + "parse-srcset": "^1.0.2", + "postcss": "^8.3.11" + } + }, + "node_modules/sanitize-html/node_modules/is-plain-object": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", + "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/sax": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", @@ -32574,9 +32875,9 @@ } }, "node_modules/tslib": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", - "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==" }, "node_modules/tunnel-agent": { "version": "0.6.0", @@ -32743,6 +33044,20 @@ "node": ">=0.10.0" } }, + "node_modules/uncontrollable": { + "version": "7.2.1", + "resolved": "https://registry.npmjs.org/uncontrollable/-/uncontrollable-7.2.1.tgz", + "integrity": "sha512-svtcfoTADIB0nT9nltgjujTi7BzVmwjZClOmskKu/E8FW9BXzg9os8OLr4f8Dlnk0rYWJIWr4wv9eKUXiQvQwQ==", + "dependencies": { + "@babel/runtime": "^7.6.3", + "@types/react": ">=16.9.11", + "invariant": "^2.2.4", + "react-lifecycles-compat": "^3.0.4" + }, + "peerDependencies": { + "react": ">=15.0.0" + } + }, "node_modules/undici-types": { "version": "5.26.5", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", @@ -33348,6 +33663,27 @@ "node": ">=0.10.0" } }, + "node_modules/use-isomorphic-layout-effect": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/use-isomorphic-layout-effect/-/use-isomorphic-layout-effect-1.2.0.tgz", + "integrity": "sha512-q6ayo8DWoPZT0VdG4u3D3uxcgONP3Mevx2i2b0434cwWBoL+aelL1DzkXI6w3PhTZzUeR2kaVlZn70iCiseP6w==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, + "node_modules/use-sync-external-store": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.4.0.tgz", + "integrity": "sha512-9WXSPC5fMv61vaupRkCKCxsPxBocVnwakBEkMIHHpkTTg6icbJtg6jzgtLDm4bl3cSHAca52rYWih0k4K3PfHw==", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -33833,6 +34169,14 @@ "node": ">= 0.4" } }, + "node_modules/warning": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz", + "integrity": "sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w==", + "dependencies": { + "loose-envify": "^1.0.0" + } + }, "node_modules/warning-symbol": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/warning-symbol/-/warning-symbol-0.1.0.tgz", diff --git a/package.json b/package.json index 14a6b0d..d2002d0 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "@emotion/styled": "^11.11.0", "@mdx-js/react": "^3.0.0", "@mui/material": "^5.14.19", + "@xras/ui": "^0.5.3", "clsx": "^2.0.0", "docusaurus": "^1.14.7", "docusaurus-lunr-search": "^3.4.0", diff --git a/src/components/DiscoverNSF.js b/src/components/DiscoverNSF.js index d582b56..7b68f56 100644 --- a/src/components/DiscoverNSF.js +++ b/src/components/DiscoverNSF.js @@ -1,4 +1,5 @@ import React, { useEffect } from 'react'; +import { onRampsResourceCatalog, shadowTarget } from '@xras/ui'; const DiscoverNSF = () => { useEffect(() => { @@ -16,9 +17,6 @@ const DiscoverNSF = () => { // Dynamically import and initialize the script const loadScript = async () => { const baseUrl = 'https://esm.sh/@xras/ui@onramps_v1/dist'; - const { onRampsResourceCatalog, shadowTarget } = await import( - 'https://esm.sh/@xras/ui@onramps_v1/dist/xras-ui.js' - ); onRampsResourceCatalog({ target: shadowTarget( From 3cca379d5e6219ddd87c3f83dd502a0db69c226b Mon Sep 17 00:00:00 2001 From: Manjila Singh Date: Wed, 18 Dec 2024 21:53:16 +0000 Subject: [PATCH 4/7] Modified sidebar position --- docs/services/external-resources/nsf-access/access.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/services/external-resources/nsf-access/access.md b/docs/services/external-resources/nsf-access/access.md index 0c107c5..276b12e 100644 --- a/docs/services/external-resources/nsf-access/access.md +++ b/docs/services/external-resources/nsf-access/access.md @@ -1,5 +1,5 @@ --- -sidebar_position: 2 +sidebar_position: 1 title: "Accessing JetStream2" description: "Access JetStream2" tags: From 44a96160ebd211e8e3fd5e602d1d72fe9f2e5618 Mon Sep 17 00:00:00 2001 From: Manjila Singh Date: Wed, 18 Dec 2024 21:53:38 +0000 Subject: [PATCH 5/7] Fixed build errors --- docs/services/external-resources/nsf-access/explore.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/services/external-resources/nsf-access/explore.md b/docs/services/external-resources/nsf-access/explore.md index 7163947..32ad6f2 100644 --- a/docs/services/external-resources/nsf-access/explore.md +++ b/docs/services/external-resources/nsf-access/explore.md @@ -8,7 +8,11 @@ tags: --- +import BrowserOnly from '@docusaurus/BrowserOnly'; -import DiscoverNSF from '@site/src/components/DiscoverNSF'; - - + + {() => { + const DiscoverNSF = require('@site/src/components/DiscoverNSF').default; + return ; + }} + \ No newline at end of file From f79935809abccc859a2f70d86374d2fe027fee95 Mon Sep 17 00:00:00 2001 From: Manjila Singh Date: Thu, 19 Dec 2024 16:36:41 +0000 Subject: [PATCH 6/7] Changed sidebar position --- docs/services/external-resources/nsf-access/access.md | 2 +- docs/services/external-resources/nsf-access/explore.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/services/external-resources/nsf-access/access.md b/docs/services/external-resources/nsf-access/access.md index 276b12e..0c107c5 100644 --- a/docs/services/external-resources/nsf-access/access.md +++ b/docs/services/external-resources/nsf-access/access.md @@ -1,5 +1,5 @@ --- -sidebar_position: 1 +sidebar_position: 2 title: "Accessing JetStream2" description: "Access JetStream2" tags: diff --git a/docs/services/external-resources/nsf-access/explore.md b/docs/services/external-resources/nsf-access/explore.md index 32ad6f2..b2621dd 100644 --- a/docs/services/external-resources/nsf-access/explore.md +++ b/docs/services/external-resources/nsf-access/explore.md @@ -1,5 +1,5 @@ --- -sidebar_position: 2 +sidebar_position: 1 title: "Discover NSF ACCESS resources" description: "Explore NSF resources" tags: From 0338149a3024b00aeaabf6417a98a527683e0e1b Mon Sep 17 00:00:00 2001 From: Manjila Singh Date: Thu, 19 Dec 2024 17:05:55 +0000 Subject: [PATCH 7/7] Update DiscoverNSF.js --- src/components/DiscoverNSF.js | 42 +++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/components/DiscoverNSF.js b/src/components/DiscoverNSF.js index 7b68f56..6f722e9 100644 --- a/src/components/DiscoverNSF.js +++ b/src/components/DiscoverNSF.js @@ -14,6 +14,30 @@ const DiscoverNSF = () => { resourceCatalogDiv.id = 'resource-catalog-react'; document.body.appendChild(resourceCatalogDiv); + // Function to style badges + const styleBadges = (shadowRoot) => { + const badges = shadowRoot.querySelectorAll('.badge'); + badges.forEach((badge) => { + badge.classList.remove('text-bg-secondary'); + badge.style.color = 'black'; + badge.style.backgroundColor = 'white'; + }); + }; + + // Function to initialize MutationObserver + const observeShadowDom = (shadowRoot) => { + const observer = new MutationObserver(() => { + styleBadges(shadowRoot); + }); + + observer.observe(shadowRoot, { + childList: true, + subtree: true, + }); + + return observer; + }; + // Dynamically import and initialize the script const loadScript = async () => { const baseUrl = 'https://esm.sh/@xras/ui@onramps_v1/dist'; @@ -32,17 +56,11 @@ const DiscoverNSF = () => { const shadowRoot = shadowHost.shadowRoot; if (shadowRoot) { - // Query inside shadowRoot for the badges - const badges = shadowRoot.querySelectorAll('.badge'); - - badges.forEach((badge) => { - // Remove the 'text-bg-secondary' class if it exists - badge.classList.remove('text-bg-secondary'); + // Apply initial styles to badges + styleBadges(shadowRoot); - // Apply inline styles for color and background - badge.style.color = 'black'; // Set text color to black - badge.style.backgroundColor = 'white'; // Clear any background color - }); + // Observe for changes in the shadow DOM + const observer = observeShadowDom(shadowRoot); // Also, check and modify the bootstrap-fonts element's data-bs-theme const element = shadowRoot.querySelector('.bootstrap-fonts'); @@ -54,12 +72,12 @@ const DiscoverNSF = () => { } else { console.log('Shadow root not found'); } - }, 500); + }, 100); }; loadScript(); - // Cleanup function to remove elements when component unmounts + // Cleanup function to remove elements and observer when component unmounts return () => { document.head.removeChild(link); document.body.removeChild(resourceCatalogDiv);