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. | | uiShellAriaLabel | <code>string</code> | -- | Specify the ARIA label for the header. |
| href | <code>string</code> | -- | Specify the `href` attribute. | | href | <code>string</code> | -- | Specify the `href` attribute. |
| company | <code>string</code> | -- | Specify the company name. | | 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. | | ref | <code>null &#124; HTMLAnchorElement</code> | `null` | Obtain a reference to the HTML anchor element. |
### Slots ### Slots

View file

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

View file

@ -32,9 +32,9 @@
/** /**
* Specify the platform name * Specify the platform name
* Alternatively, use the named slot "platform" (e.g. <span slot="platform">...</span>) * 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 * 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 * Specify the platform name
* Alternatively, use the named slot "platform" (e.g. <span slot="platform">...</span>) * Alternatively, use the named slot "platform" (e.g. <span slot="platform">...</span>)
* @default ""
*/ */
platformName?: string; platformName?: string;