fix(ui-shell): initialize platformName as empty string

Prevents "undefined" from being rendered.
This commit is contained in:
Eric Liu 2020-10-24 14:31:40 -07:00
commit 8950920a10
4 changed files with 40 additions and 61 deletions

View file

@ -1737,7 +1737,7 @@ import { Header } from "carbon-components-svelte";
| uiShellAriaLabel | <code>string</code> | -- | Specify the ARIA label for the header. |
| href | <code>string</code> | -- | Specify the `href` attribute. |
| company | <code>string</code> | -- | Specify the company name. |
| platformName | <code>string</code> | -- | Specify the platform name. Alternatively, use the named slot "platform" (e.g. &lt;span slot="platform"&gt;...&lt;/span&gt;). |
| platformName | <code>string</code> | `""` | Specify the platform name. Alternatively, use the named slot "platform" (e.g. &lt;span slot="platform"&gt;...&lt;/span&gt;). |
| ref | <code>null &#124; HTMLAnchorElement</code> | `null` | Obtain a reference to the HTML anchor element. |
### Slots

View file

@ -5361,6 +5361,7 @@
"platformName",
{
"kind": "let",
"value": "\"\"",
"type": "string",
"description": "Specify the platform name\nAlternatively, use the named slot \"platform\" (e.g. <span slot=\"platform\">...</span>)"
}
@ -5381,14 +5382,14 @@
{
"attributes": [
{
"start": 1398,
"end": 1420,
"start": 1394,
"end": 1416,
"type": "Attribute",
"name": "name",
"value": [
{
"start": 1404,
"end": 1419,
"start": 1400,
"end": 1415,
"type": "Text",
"raw": "skip-to-content",
"data": "skip-to-content"
@ -5406,14 +5407,14 @@
{
"attributes": [
{
"start": 1740,
"end": 1755,
"start": 1736,
"end": 1751,
"type": "Attribute",
"name": "name",
"value": [
{
"start": 1746,
"end": 1754,
"start": 1742,
"end": 1750,
"type": "Text",
"raw": "platform",
"data": "platform"
@ -5423,13 +5424,13 @@
],
"children": [
{
"start": 1756,
"end": 1770,
"start": 1752,
"end": 1766,
"type": "MustacheTag",
"expression": {
"type": "Identifier",
"start": 1757,
"end": 1769,
"start": 1753,
"end": 1765,
"loc": {
"start": {
"line": 72,
@ -5462,8 +5463,8 @@
[
"click",
{
"start": 1614,
"end": 1622,
"start": 1610,
"end": 1618,
"type": "EventHandler",
"name": "click",
"modifiers": [],
@ -5743,61 +5744,38 @@
},
{
"start": 608,
"end": 669,
"type": "IfBlock",
"expression": {
"type": "Identifier",
"start": 613,
"end": 617,
"loc": {
"start": {
"line": 30,
"column": 9
},
"end": {
"line": 30,
"column": 13
}
},
"name": "icon"
},
"children": [
{
"start": 625,
"end": 659,
"end": 642,
"type": "InlineComponent",
"name": "svelte:component",
"attributes": [],
"children": [],
"expression": {
"type": "Identifier",
"start": 650,
"end": 654,
"start": 633,
"end": 637,
"loc": {
"start": {
"line": 31,
"column": 31
"line": 30,
"column": 29
},
"end": {
"line": 31,
"column": 35
"line": 30,
"column": 33
}
},
"name": "icon"
}
}
]
},
{
"start": 669,
"end": 672,
"start": 642,
"end": 645,
"type": "Text",
"raw": "\n ",
"data": "\n "
}
],
"default": true,
"default_value": "\n \n{#if icon}\n <svelte:component this=\"{icon}\" />\n {/if}\n\n \n"
"default_value": "\n \n<svelte:component this=\"{icon}\" />\n\n \n"
}
]
],
@ -13425,8 +13403,8 @@
[
"click",
{
"start": 25,
"end": 33,
"start": 21,
"end": 29,
"type": "EventHandler",
"name": "click",
"modifiers": [],
@ -13436,8 +13414,8 @@
[
"mouseover",
{
"start": 36,
"end": 48,
"start": 30,
"end": 42,
"type": "EventHandler",
"name": "mouseover",
"modifiers": [],
@ -13447,8 +13425,8 @@
[
"mouseenter",
{
"start": 51,
"end": 64,
"start": 43,
"end": 56,
"type": "EventHandler",
"name": "mouseenter",
"modifiers": [],
@ -13458,8 +13436,8 @@
[
"mouseleave",
{
"start": 67,
"end": 80,
"start": 57,
"end": 70,
"type": "EventHandler",
"name": "mouseleave",
"modifiers": [],

View file

@ -32,9 +32,9 @@
/**
* Specify the platform name
* Alternatively, use the named slot "platform" (e.g. <span slot="platform">...</span>)
* @type {string} [platformName]
* @type {string} [platformName=""]
*/
export let platformName = undefined;
export let platformName = "";
/**
* Obtain a reference to the HTML anchor element

1
types/index.d.ts vendored
View file

@ -1683,6 +1683,7 @@ export class Header extends CarbonSvelteComponent {
/**
* Specify the platform name
* Alternatively, use the named slot "platform" (e.g. <span slot="platform">...</span>)
* @default ""
*/
platformName?: string;