Merge pull request #627 from ing-bank/chore/fix-switch-storybook
chore(switch): fix storybook rendering
This commit is contained in:
commit
cd4d2fa561
1 changed files with 12 additions and 9 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import { Story, Meta, html } from '@open-wc/demoing-storybook';
|
import { Story, Meta, html } from '@open-wc/demoing-storybook';
|
||||||
import { Validator } from '@lion/validate';
|
import { Validator } from '@lion/validate';
|
||||||
|
|
||||||
import { LionSwitch } from '../src/LionSwitch';
|
import { LionSwitch } from '../index.js';
|
||||||
import '../lion-switch.js';
|
import '../lion-switch.js';
|
||||||
import '@lion/helpers/sb-action-logger.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!";
|
return "You won't get the latest news!";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
class CustomSwitch extends LionSwitch {
|
const tagName = 'custom-switch';
|
||||||
static get validationTypes() {
|
if (!customElements.get(tagName)) {
|
||||||
return [...super.validationTypes, 'info'];
|
customElements.define(
|
||||||
}
|
tagName,
|
||||||
}
|
class CustomSwitch extends LionSwitch {
|
||||||
if (!customElements.get('custom-switch')) {
|
static get validationTypes() {
|
||||||
customElements.define('custom-switch', CustomSwitch);
|
return [...super.validationTypes, 'info'];
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return html`
|
return html`
|
||||||
<custom-switch
|
<custom-switch
|
||||||
|
|
@ -97,7 +100,7 @@ Simple example that illustrates where validation feedback will be displayed.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { Validator } from '@lion/validate';
|
import { Validator } from '@lion/validate';
|
||||||
import { LionSwitch } from '@lion/switch/src/LionSwitch';
|
import { LionSwitch } from '@lion/switch';
|
||||||
|
|
||||||
const IsTrue = class extends Validator {
|
const IsTrue = class extends Validator {
|
||||||
static get validatorName() {
|
static get validatorName() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue