Skip to content

Commit

Permalink
feat(core/appliaction-header): load optional application logo
Browse files Browse the repository at this point in the history
  • Loading branch information
danielleroux committed Oct 6, 2022
1 parent bfdc48c commit 89ecb72
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,34 @@
* LICENSE file in the root directory of this source tree.
*/

import { Component, h, Host, Prop } from '@stencil/core';
import { Component, Element, h, Host, Prop } from '@stencil/core';

@Component({
tag: 'ix-application-header',
styleUrl: 'application-header.scss',
shadow: true,
})
export class ApplicationHeader {
@Element() host!: HTMLIxApplicationHeaderElement;

/**
* Application name
*/
@Prop() name: string;

componentDidLoad() {
this.attachSiemensLogoIfLoaded();
}

private async attachSiemensLogoIfLoaded() {
await window.customElements.whenDefined('ix-siemens-logo');
const logoElement = document.createElement('ix-siemens-logo');

if (!this.host.querySelector('[slot="logo"]')) {
this.host.shadowRoot.querySelector('.logo').appendChild(logoElement);
}
}

render() {
return (
<Host>
Expand Down
8 changes: 0 additions & 8 deletions packages/core/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
<script nomodule src="/build/siemens-ix.js"></script>

<link rel="stylesheet" href="/build/siemens-ix.css" />
<!-- Temp. Workaround for brand theme to live inside core package -->
<link rel="stylesheet" href="/build/ix-brand-theme/ix-brand-theme.css" />
<script
type="module"
src="/build/ix-brand-theme/ix-brand-theme.esm.js"
></script>
<script nomodule src="/build/ix-brand-theme/ix-brand-theme.js"></script>

<link rel="stylesheet" href="/build/ix-icons/css/ix-icons.css" />
</head>
<body style="margin: 0px; height: 100vh">
Expand Down

0 comments on commit 89ecb72

Please sign in to comment.