如何最好地将全局切换添加到Storybook中以执行自定义JS
在 Storybook 中,我想添加一个全局控制,基本上是一个下拉列表,我可以在两个或多个值之间切换。选择一个值应执行自定义JS脚本(在其中使用所选值)。这样做的最好方法是什么?
用户酶 我有一个带有两个或多个主题的主题对象const主题= {light:{},dark:{},颜色:{}}
> 哪个记录了使用的颜色。我想动态选择的那些,然后从中创建CSS变量,然后将它们注入文档头部。所有这些都来自Storybook,它应该一直影响所有组件,因此我想一个全局切换或选择。
Within storybook I'd like to add a global control, basically a dropdown where I can switch between two or more values. Selecting one value should execute a custom JS scrip (in which I use the selected value). What is the best way of doing this?
usecase
I have a theme object with two or more themes const themes = {light: {}, dark:{}, color:{}}
which documentes the used colors. Those I want to dynamically select, then create CSS variables out of them and inject them into the documents head. All from within storybook and it should effect all components all the time, so a global toggle or select I thought.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论