From e521b1caf0b229e097b10e40b5d3d8596a59843a Mon Sep 17 00:00:00 2001 From: qa46hx Date: Thu, 5 Mar 2020 10:46:37 +0100 Subject: [PATCH] chore(switch): fix storybook rendering --- packages/switch/stories/index.stories.mdx | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/switch/stories/index.stories.mdx b/packages/switch/stories/index.stories.mdx index 401575177..d3e9c4513 100644 --- a/packages/switch/stories/index.stories.mdx +++ b/packages/switch/stories/index.stories.mdx @@ -1,7 +1,7 @@ import { Story, Meta, html } from '@open-wc/demoing-storybook'; import { Validator } from '@lion/validate'; -import { LionSwitch } from '../src/LionSwitch'; +import { LionSwitch } from '../index.js'; import '../lion-switch.js'; import '@lion/helpers/sb-action-logger.js'; @@ -76,13 +76,16 @@ Simple example that illustrates where validation feedback will be displayed. return "You won't get the latest news!"; } }; - class CustomSwitch extends LionSwitch { - static get validationTypes() { - return [...super.validationTypes, 'info']; - } - } - if (!customElements.get('custom-switch')) { - customElements.define('custom-switch', CustomSwitch); + const tagName = 'custom-switch'; + if (!customElements.get(tagName)) { + customElements.define( + tagName, + class CustomSwitch extends LionSwitch { + static get validationTypes() { + return [...super.validationTypes, 'info']; + } + }, + ); } return html`