mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 05:51:48 +08:00
Fixes for string based stories
This commit is contained in:
parent
b37a59fc3b
commit
ce483fa8c3
@ -41,7 +41,7 @@ class WrapStory extends HTMLElement {
|
|||||||
render(component) {
|
render(component) {
|
||||||
let tag = component;
|
let tag = component;
|
||||||
if (typeof component === 'string') {
|
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);
|
tag = document.createElement(tagName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
<dom-module id="polymer-playground-app">
|
<dom-module id="polymer-playground-app">
|
||||||
<template>
|
<template>
|
||||||
<h2>Hello [[prop1]]!</h2>
|
<h2>[[title]]</h2>
|
||||||
|
<p>Hello [[prop1]]!</p>
|
||||||
<playground-button></playground-button>
|
<playground-button></playground-button>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
@ -14,7 +15,8 @@
|
|||||||
prop1: {
|
prop1: {
|
||||||
type: String,
|
type: String,
|
||||||
value: 'polymer-playground-app'
|
value: 'polymer-playground-app'
|
||||||
}
|
},
|
||||||
|
title: String,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,16 @@ storiesOf('Welcome', module).add(
|
|||||||
() => '<storybook-welcome-to-polymer></storybook-welcome-to-polymer>'
|
() => '<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)
|
storiesOf('Button', module)
|
||||||
.addDecorator(withKnobs)
|
.addDecorator(withKnobs)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user