mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
feat(ui-shell): add expandedByDefault prop to Header
This commit is contained in:
parent
9632ae592b
commit
76ac0505e3
1 changed files with 8 additions and 3 deletions
|
@ -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} </span>
|
||||||
|
|
||||||
{/if}
|
{/if}
|
||||||
<slot name="platform">{platformName}</slot>
|
<slot name="platform">{platformName}</slot>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue