Skip to content

Commit

Permalink
feat(ui-shell): make company in Header slottable (#1764)
Browse files Browse the repository at this point in the history
  • Loading branch information
p0lish authored Jul 13, 2023
1 parent 14d584d commit 9b3f014
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
11 changes: 6 additions & 5 deletions COMPONENT_INDEX.md
Original file line number Diff line number Diff line change
Expand Up @@ -1584,11 +1584,12 @@ None.

### Slots

| Slot name | Default | Props | Fallback |
| :-------------- | :------ | :---- | :-------------------------- |
| -- | Yes | -- | -- |
| platform | No | -- | <code>{platformName}</code> |
| skip-to-content | No | -- | -- |
| Slot name | Default | Props | Fallback |
| :-------------- | :------ | :---- | :--------------------------- |
| -- | Yes | -- | -- |
| company | No | -- | <code>{company}&nbsp;</code> |
| platform | No | -- | <code>{platformName}</code> |
| skip-to-content | No | -- | -- |

### Events

Expand Down
6 changes: 6 additions & 0 deletions docs/src/COMPONENT_API.json
Original file line number Diff line number Diff line change
Expand Up @@ -4833,6 +4833,12 @@
"moduleExports": [],
"slots": [
{ "name": "__default__", "default": true, "slot_props": "{}" },
{
"name": "company",
"default": false,
"fallback": "{company}&nbsp;",
"slot_props": "{}"
},
{
"name": "platform",
"default": false,
Expand Down
6 changes: 4 additions & 2 deletions src/UIShell/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@
{...$$restProps}
on:click
>
{#if company}
<span class:bx--header__name--prefix="{true}">{company}&nbsp;</span>
{#if company || $$slots.company}
<span class:bx--header__name--prefix="{true}"
><slot name="company">{company}&nbsp;</slot></span
>
{/if}
<slot name="platform">{platformName}</slot>
</a>
Expand Down
2 changes: 1 addition & 1 deletion types/UIShell/Header.svelte.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ export interface HeaderProps
export default class Header extends SvelteComponentTyped<
HeaderProps,
{ click: WindowEventMap["click"] },
{ default: {}; platform: {}; ["skip-to-content"]: {} }
{ default: {}; company: {}; platform: {}; ["skip-to-content"]: {} }
> {}

0 comments on commit 9b3f014

Please sign in to comment.