Open IvanSanchez-uam opened 1 year ago
@IvanSanchez-uam Could you open a PR up so that I can see what this looks like. Early thoughts - I'm not a fan of adding more parameters in the annotation and instead want to explore other ways to handle this. Open to ideas
When we skip a preview function with
@ShowkaseComposable(skip = true)
this preview will not be included into thecomponentList : List<ShowkaseBrowserComponent>
that is the expected behavior, but there is a case when I make the integration with Paparazzi where I don't want to show the preview in the componentBrowser but I want to generate the screenshot, right now this is not possible because as far as the preview was skipped there will not be metadata for it.A component that is skipped will not be including in the next list
I made changes in the repo locally and the solution was adding a new property into the
@ShowkaseComposable
annotation, I named the propertygenerateScreenshot
as I show next:and made changes where needed to use this property in the code. The usage of this property looks like this
The generated file for this preview now includes the generateScreenshot property
This property in general helps us to generate or not the screenshot with Paparazzi integration.
I have another need, as far as we can not handle the name of the screenshot too much with Paparazzi and It could be something short like the function name of the preview we can write the elementName into the metadata witch is already defined in Showkasemetadata.Component.
and write the property into the CodeBlock.Builder.addShowkaseBrowserComponent() method of the class WriterUtils.kt like this
and the result of this will look like this in the generated file
I have the complete implementation, let me know if you want to see it and I can share it. Hope this make sense to you as well.