diff --git a/components/mdc/Menu/Menu.svelte b/components/mdc/Menu/Menu.svelte index 1694c9c1..fb0c2b87 100644 --- a/components/mdc/Menu/Menu.svelte +++ b/components/mdc/Menu/Menu.svelte @@ -10,8 +10,6 @@ export let currentUrl = '' let menu = {} let element = {} -//don't use window for ssr -$: currentUrl = window?.location?.pathname || currentUrl $: menu.open = menuOpen onMount(() => { diff --git a/index.d.ts b/index.d.ts index 0db9758c..db4fa8c7 100644 --- a/index.d.ts +++ b/index.d.ts @@ -161,6 +161,7 @@ declare module '@silintl/ui-components' { interface MenuProps extends svelte.JSX.HTMLAttributes { menuItems?: MenuItem[] menuOpen?: boolean + currentUrl?: string } export class Menu extends SvelteComponentTyped {} diff --git a/stories/Menu.stories.svelte b/stories/Menu.stories.svelte index 0de425eb..147f02c0 100644 --- a/stories/Menu.stories.svelte +++ b/stories/Menu.stories.svelte @@ -7,6 +7,7 @@ let content = 'Menu Button' const args = { class: 'dib relative opacity1', //for some reason the menu isn't behaving in storybook menuOpen: true, + currentUrl: '/?path=/story/atoms-menu--primary', menuItems: [ { subtitle: 'Alerts', @@ -15,16 +16,17 @@ const args = { icon: 'notifications', label: 'Alerts', action: () => alert('Hello!'), + url: '/?path=/story/atoms-menu--primary', }, { icon: 'settings', label: 'User settings', - url: '/household/settings', + url: '/', }, { icon: 'logout', label: 'Sign out', - url: '/logout', + url: '/', }, ], toggleMenu() {