javascript - 如何将现有的 jsx 排版库导入 Storybook 而不是使用 css 文件?
问题描述
我正在尝试将 H1.jsx 文件从我的排版库导入 Storybook,因此每当我进行更改时,我不必总是更新库和故事书。如何将 H1.jsx 文件导入 Storybook?前三个文件是我从typograpy.css 文件中导入的。
排版.js
export const Typography = ({ size, label }) => {
return (
<div
className={['storybook-typography', `storybook-typography--${size}`].join(
' '
)}
>
{label}
</div>
);
};
Typography.propTypes = {
size: PropTypes.oneOf([
'h1',
排版.stories.js
const Template = (args) => <Typography {...args} />;
export const H1 = Template.bind({});
H1.args = {
size: 'h1',
label: 'H1/Lato/Light/96px',
};
排版.css
.storybook-typography {
font-family: 'lato';
}
.storybook-typography--h1 {
font-size: 96px;
font-style: 'normal';
font-weight: 300;
letter-spacing: -1.5px;
}
H1.jsx
export const H1 = styled.div`
font-size: 96px;
font-family: lato;
font-style: 'normal';
font-weight: 300;
letter-spacing: -1.5px;
`;
解决方案
推荐阅读
- api - 从颤振应用程序发出 Https 请求?
- email - 使用 RASA 构建电子邮件机器人 - 一般关于电子邮件机器人对话管理
- r - 如何将 GREPL 与 R 中类似模式的列中的字符串一起使用
- python - 张量流中部分输入的排列
- python - 查找图像中红色像素的坐标
- android - 如何在导航视图上隐藏地图视图视图
- c++ - 变量的内部可以是另一个变量的名称吗
- c - 使用计数排序按升序对字符数组进行排序
- kubernetes - 在不同 Keycloak 实例之间同步用户
- jquery - jQuery: Move list items based on attribute matches