Conversation
squrious
left a comment
There was a problem hiding this comment.
Thank you @WebMamba!
That looks good, just a few things we could discuss.
I wonder if we can go a little bit further, and provide some default args to the story based on static analysis of the component. What do you think, would it be doable in a simple first version, or is it too complicated to introspect Twig components for the moment?
Also, is it possible to write tests for this maker?
| $container->register('storybook.maker.story_renderer', \Storybook\Maker\StoryRenderer::class) | ||
| ->setArgument(0, new Reference('maker.generator')) | ||
| ->setArgument(1, new Reference('ux.twig_component.component_factory')) | ||
| ->setArgument(2, '%kernel.project_dir%/stories'); |
There was a problem hiding this comment.
Stories path depends on Storybook configuration, so I think this should be handled in a interactive prompt at maker level, with smart suggestions like stories/ or the current component template directory?
| @@ -0,0 +1,12 @@ | |||
| import <?php echo $componentName; ?> from "../templates/<?php echo $template; ?>"; | |||
There was a problem hiding this comment.
Relates to the previous comment on stories path: I'd prefer the full path to be dynamically generated depending on where the story file is created.
| `, | ||
| }) | ||
| } | ||
|
|
There was a problem hiding this comment.
It would be nice to add a default story here, like
export const Default = {};This is required for Storybook to properly index the story file, otherwise we'll get an indexing error AFAIK.
| use Symfony\Bundle\MakerBundle\Generator; | ||
| use Symfony\UX\TwigComponent\ComponentFactory; | ||
|
|
||
| class StoryRenderer |
There was a problem hiding this comment.
Is it possible to rename this class to something that doesn't collide with the main StoryRenderer? Like StoryGenerator?
Also this class could be final
| /** | ||
| * @method string getCommandDescription() | ||
| */ | ||
| class MakeStory extends AbstractMaker |
No description provided.