refactor(ui-shell): use $$restProps, remove cx

This commit is contained in:
Eric Liu 2020-07-19 06:33:06 -07:00
commit 1e5333dd64
26 changed files with 230 additions and 425 deletions

View file

@ -5,23 +5,23 @@
export let platformName = undefined;
export let isSideNavOpen = undefined;
import { cx } from '../../../lib';
import HamburgerMenu from '../SideNav/HamburgerMenu.svelte';
import HamburgerMenu from "../SideNav/HamburgerMenu.svelte";
let winWidth = undefined;
$: isSideNavOpen = winWidth >= 1056;
$: ariaLabel = company + (uiShellAriaLabel || $$props['aria-label'] || platformName);
$: isSideNavOpen = winWidth >= 1056;
$: ariaLabel =
company + (uiShellAriaLabel || $$props["aria-label"] || platformName);
</script>
<svelte:window bind:innerWidth={winWidth} />
<header aria-label={ariaLabel} class={cx('--header')} role="banner">
<header role="banner" aria-label={ariaLabel} class:bx--header={true}>
{#if winWidth < 1056}
<HamburgerMenu bind:isOpen={isSideNavOpen} />
{/if}
<a class={cx('--header__name')} {href} on:click>
<span class={cx('--header__name--prefix')}>{company}</span>
<a {href} class:bx--header__name={true} {...$$restProps} on:click>
<span class:bx--header__name--prefix={true}>{company}</span>
&nbsp;{platformName}
</a>
<slot />