feat(ui-shell): add expandedByDefault prop to Header

This commit is contained in:
Eric Liu 2020-08-02 05:52:01 -07:00
commit 76ac0505e3

View file

@ -1,4 +1,10 @@
<script> <script>
/**
* Set to `false` to hide the side nav by default
* @type {boolean} [expandedByDefault=true]
*/
export let expandedByDefault = true;
/** /**
* Set to `true` to open the side nav * Set to `true` to open the side nav
* @type {boolean} [isSideNavOpen=false] * @type {boolean} [isSideNavOpen=false]
@ -34,7 +40,7 @@
let winWidth = undefined; let winWidth = undefined;
$: isSideNavOpen = winWidth >= 1056; $: isSideNavOpen = expandedByDefault && winWidth >= 1056;
$: ariaLabel = company $: ariaLabel = company
? `${company} ` ? `${company} `
: "" + (uiShellAriaLabel || $$props["aria-label"] || platformName); : "" + (uiShellAriaLabel || $$props["aria-label"] || platformName);
@ -49,8 +55,7 @@
{/if} {/if}
<a {href} class:bx--header__name={true} {...$$restProps} on:click> <a {href} class:bx--header__name={true} {...$$restProps} on:click>
{#if company} {#if company}
<span class:bx--header__name--prefix={true}>{company}</span> <span class:bx--header__name--prefix={true}>{company}&nbsp;</span>
&nbsp;
{/if} {/if}
<slot name="platform">{platformName}</slot> <slot name="platform">{platformName}</slot>
</a> </a>