简体   繁体   English

反应 - 故事书。 引导图标组件不显示在故事书中

[英]React - storybook. Bootstrap Icon components don't show in storybook

I am building React storybook components using react-bootstrap.我正在使用 react-bootstrap 构建 React 故事书组件。 Almost components are completed well.几乎组件都完成得很好。 But only some components that includes bootstrap icons don't show in storybook.但只有一些包含引导图标的组件不会显示在故事书中。 Is there any way to fix this issue?有没有办法解决这个问题? Thanks.谢谢。

Sometimes the issue is for linked components, in this case, you need import each icon from SVG.有时问题出在链接组件上,在这种情况下,您需要从 SVG 导入每个图标。

import {
  faEdit,
  faUser,
  faCartShopping,
  faHeart,
} from "@fortawesome/free-solid-svg-icons";

Don't forget link the components in console with: npm link不要忘记将控制台中的组件链接到:npm 链接

import "bootstrap-icons/font/bootstrap-icons.css"; in the .storybook/preview.js file solved that issue..storybook/preview.js文件中解决了这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM