Skip to content

Commit

Permalink
feat(on-ramps): Modifying shadowRender to use a provided baseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccaeve committed Sep 20, 2024
1 parent a2b648b commit 0da8ce5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css"
/>
<script type="module">
const baseUrl = "http://localhost:63313/dist";
import {
onRampsResourceCatalog,
shadowTarget,
} from "http://localhost:52984/xras-ui.js";
} from "http://localhost:63313/dist/xras-ui.js";
onRampsResourceCatalog({
target: shadowTarget(
document.getElementById("resource-catalog-react"),
{ accessStyles: true }
{ accessStyles: true, baseUrl }
),
onRamps: true,
});
Expand Down
4 changes: 2 additions & 2 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import catalogSlice from "./resource-catalog/helpers/catalogSlice";

export function shadowTarget(
host,
{ bootstrapFonts = true, bootstrapVariables = true, access = false } = {}
{ bootstrapFonts = true, bootstrapVariables = true, access = false, baseUrl = null } = {}
) {
const shadow = host.attachShadow({ mode: "open" });
const bsOuter = document.createElement("div");
Expand All @@ -35,7 +35,7 @@ export function shadowTarget(
const bsStyle = document.createElement("link");
const uiStyle = document.createElement("link");
const accessStyle = document.createElement("link");
const baseUrl = import.meta.url.replace(/\/[^/]+$/, "");
baseUrl = baseUrl == null ? import.meta.url.replace(/\/[^/]+$/, "") : baseUrl;

bsStyle.rel = "stylesheet";
bsStyle.href = `${baseUrl}/bootstrap.css`;
Expand Down

0 comments on commit 0da8ce5

Please sign in to comment.