diff --git a/src/components/sbb-signet/sbb-signet.stories.tsx b/src/components/sbb-signet/sbb-signet.stories.tsx index 4e548bf4d7..4a2a5da3e5 100644 --- a/src/components/sbb-signet/sbb-signet.stories.tsx +++ b/src/components/sbb-signet/sbb-signet.stories.tsx @@ -1,8 +1,9 @@ /** @jsx h */ import { h, JSX } from 'jsx-dom'; import readme from './readme.md'; -import type { Meta, StoryObj, ArgTypes, Args } from '@storybook/html'; +import type { Meta, StoryObj, ArgTypes, Args } from '@storybook/web-components'; import type { InputType } from '@storybook/types'; +import './sbb-signet'; const Template = (args): JSX.Element => ; diff --git a/src/components/sbb-signet/sbb-signet.tsx b/src/components/sbb-signet/sbb-signet.tsx index 4ac0173ec3..abe0b8294f 100644 --- a/src/components/sbb-signet/sbb-signet.tsx +++ b/src/components/sbb-signet/sbb-signet.tsx @@ -1,26 +1,25 @@ -import { Component, h, JSX, Prop } from '@stencil/core'; - import { InterfaceSignetAttributes } from './sbb-signet.custom'; +import { CSSResult, html, LitElement, nothing, TemplateResult } from 'lit'; +import { customElement, property } from 'lit/decorators.js'; +import Style from './sbb-signet.scss?lit&inline'; + +@customElement('sbb-signet') +export class SbbSignet extends LitElement { + public static override styles: CSSResult = Style; -@Component({ - shadow: true, - styleUrl: 'sbb-signet.scss', - tag: 'sbb-signet', -}) -export class SbbSignet { /** Visual protective room around signet. */ - @Prop({ reflect: true }) public protectiveRoom?: InterfaceSignetAttributes['protectiveRoom'] = - 'ideal'; + @property({ attribute: 'protective-room', reflect: true }) + public protectiveRoom?: InterfaceSignetAttributes['protectiveRoom'] = 'ideal'; /** Accessibility label which will be forwarded to the inner SVG signet. */ - @Prop() public accessibilityLabel = 'Logo'; + @property({ attribute: 'accessibility-label' }) public accessibilityLabel = 'Logo'; - public render(): JSX.Element { - return ( + protected override render(): TemplateResult { + return html` - {this.accessibilityLabel && {this.accessibilityLabel}} + ${this.accessibilityLabel ? html`${this.accessibilityLabel}` : nothing} - ); + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + // eslint-disable-next-line @typescript-eslint/naming-convention + 'sbb-signet': SbbSignet; } }