mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 18:31:06 +00:00
commit
fbf539ab1d
1 changed files with 5 additions and 12 deletions
|
@ -16,21 +16,14 @@
|
||||||
import HamburgerMenu from './UIShellSideNav/HamburgerMenu.svelte';
|
import HamburgerMenu from './UIShellSideNav/HamburgerMenu.svelte';
|
||||||
|
|
||||||
let isSideNavOpen = undefined;
|
let isSideNavOpen = undefined;
|
||||||
let winWidth = window.innerWidth;
|
let winWidth = undefined;
|
||||||
|
$: isSideNavOpen = winWidth >= 1056
|
||||||
window.addEventListener('resize', () => {
|
|
||||||
winWidth = window.innerWidth;
|
|
||||||
|
|
||||||
if (winWidth >= 1056) {
|
|
||||||
isSideNavOpen = true;
|
|
||||||
} else {
|
|
||||||
isSideNavOpen = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$: ariaLabel = company + (uiShellAriaLabel || $$props['aria-label'] || platformName);
|
$: ariaLabel = company + (uiShellAriaLabel || $$props['aria-label'] || platformName);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window bind:innerWidth={winWidth} />
|
||||||
|
|
||||||
<header aria-label={ariaLabel} class={cx('--header')} role="banner">
|
<header aria-label={ariaLabel} class={cx('--header')} role="banner">
|
||||||
{#if winWidth < 1056}
|
{#if winWidth < 1056}
|
||||||
<HamburgerMenu bind:isOpen={isSideNavOpen} />
|
<HamburgerMenu bind:isOpen={isSideNavOpen} />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue