Fixes for string based stories

This commit is contained in:
Léon Rodenburg 2017-11-18 16:50:28 +01:00
parent b37a59fc3b
commit ce483fa8c3
No known key found for this signature in database
GPG Key ID: 115F06257AAC658D
3 changed files with 15 additions and 4 deletions

View File

@ -41,7 +41,7 @@ class WrapStory extends HTMLElement {
render(component) {
let tag = component;
if (typeof component === 'string') {
const tagName = /<([A-Za-z0-9-]+)>/.exec(component)[1];
const tagName = /^<([A-Za-z0-9-]+)/.exec(component)[1];
tag = document.createElement(tagName);
}

View File

@ -3,7 +3,8 @@
<dom-module id="polymer-playground-app">
<template>
<h2>Hello [[prop1]]!</h2>
<h2>[[title]]</h2>
<p>Hello [[prop1]]!</p>
<playground-button></playground-button>
</template>
<script>
@ -14,7 +15,8 @@
prop1: {
type: String,
value: 'polymer-playground-app'
}
},
title: String,
};
}
}

View File

@ -12,7 +12,16 @@ storiesOf('Welcome', module).add(
() => '<storybook-welcome-to-polymer></storybook-welcome-to-polymer>'
);
storiesOf('App', module).add('full app', () => '<polymer-playground-app></polymer-playground-app>');
storiesOf('App', module)
.addDecorator(withKnobs)
.add(
'full app',
() =>
`<polymer-playground-app title="${text(
'App title',
'This is an app'
)}"></polymer-playground-app>`
);
storiesOf('Button', module)
.addDecorator(withKnobs)