Storybook withClassPropertiesKnobs only exports the first element in the template
See original GitHub issueUsing the withClassPropertiesKnobs
function only returns the first element in the template. This prevents developers from passing a custom-element with a HTML element to interact with the custom-element.
The first element is selected here and eventually returned here. Shouldn’t the whole wrapper be returned with only the custom-element in it replaced with applied knobs?
Example on what I was trying to do:
import {storiesOf, html, withKnobs, withClassPropertiesKnobs, select} from '@open-wc/demoing-storybook';
import {DraggableDrawer} from "./draggable-drawer";
storiesOf('Core UI', module)
.addDecorator(withKnobs)
.add(
'Dragable Drawer Top',
() => withClassPropertiesKnobs(DraggableDrawer, {
overrides: el => [
{
key: 'align',
fn: () => select('align', ['left', 'right','top','bottom'], el.align, 'Inherited'),
}
],
template: html`
<draggable-drawer align="${'top'}">
<h1>Drawer</h1>
<ul>
<li>List 1</li>
<li>List 2</li>
<li>List 3</li>
</ul>
</draggable-drawer>
<button onclick="document.querySelector('draggable-drawer').open()">Open Drawer</button>
`
}),
{ notes: 'Test' , options: { selectedPanel: 'storybooks/knobs/panel' }}
);
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Component Story Format (CSF) - Storybook
Every component story file consists of a required default export and one or more named exports. CSF is supported in all frameworks except...
Read more >Storybook default export (non-named) in combination with ...
However, that default export example makes use of "component" and it does not seem to have a "template" option. Is there some way...
Read more >Running JavaScript with Templates in Storybook for HTML
When working with Storybook for HTML, it can be difficult to pair a template with a JavaScript file. Learn an effective solution.
Read more >Export to Word, PDF, or another file format in Pages on iPad
Export to Word, PDF, or another file format in Pages on iPad. To save a copy of a Pages document in another format,...
Read more >Saving and exporting - Adobe Support
To save a copy of a document as a template, choose File > Save ... A document preview includes a JPEG image of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
See also #833
this helper function got replace with a storybook decorator… for a migration please see https://open-wc.org/demoing/MIGRATION.html#replaced-withclasspropertiesknobs-with-a-decorator-withwebcomponentsknobs