diff --git a/docs/index.html b/docs/index.html index 153bb52ffc..967bda1554 100644 --- a/docs/index.html +++ b/docs/index.html @@ -5,6 +5,16 @@ Carbon Components Svelte + diff --git a/docs/src/layouts/ComponentLayout.svelte b/docs/src/layouts/ComponentLayout.svelte index 5801441a9e..75fde5c088 100644 --- a/docs/src/layouts/ComponentLayout.svelte +++ b/docs/src/layouts/ComponentLayout.svelte @@ -34,10 +34,11 @@ $: multiple = api_components.length > 1; onMount(() => { - const currentTheme = window.location.search.split("?theme=")[1]; + const searchParams = new URLSearchParams(window.location.search); + const current_theme = searchParams.get("theme"); - if (["white", "g10", "g80", "g90", "g100"].includes(currentTheme)) { - theme.set(currentTheme); + if (["white", "g10", "g80", "g90", "g100"].includes(current_theme)) { + theme.set(current_theme); } }); diff --git a/docs/src/pages/_layout.svelte b/docs/src/pages/_layout.svelte index 6ab62ab866..7dd0f43d34 100644 --- a/docs/src/pages/_layout.svelte +++ b/docs/src/pages/_layout.svelte @@ -80,7 +80,14 @@ } }}" /> - +