手动建立storybook
1. Add @storybook/react
npm i --save-dev @storybook/react
2. Add react, react-dom, and babel-core
npm i --save react react-dom
npm i --save-dev babel-core
3. Then add the following NPM script to your package json in order to start the storybook later in this guide
{
"scripts": {
"storybook": "start-storybook -p 9001 -c .storybook"
}
}
4. Create the config file
To do that, simply create a file at .storybook/config.js with the following content:
import { configure } from '@storybook/react';
function loadStories() {
require('../stories/index.js'); // You can require as many stories as you need.
}
configure(loadStories, module);
5. Write your stories
Now you can write some stories inside the ../stories/index.js file, like this:
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import Button from '../components/Button'; storiesOf('Button', module)
.add('with text', () => (
<Button onClick={action('clicked')}>Hello Button</Button>
))
.add('with some emoji', () => (
<Button onClick={action('clicked')}><span role="img" aria-label="so cool">手动建立storybook的更多相关文章
- 手动建立mapping以及增加属性
只能创建index时手动建立mapping,或者新增field mapping,但是不能update field mapping 1.手动建立mappingPUT /website{ "ma ...
- Oracle XE手动建立数据库实例
参考资料为: [Oracle XE系列之三]使用OMF方式手工创建Oracle XE数据库 - 王立夫 - 博客园http://www.cnblogs.com/opfo/p/5056122.html ...
- Quarter square 查找表乘法器,手动建立rom
建立一个C的范围为0~255,内容是(C)2/4的查表 占用256个存储空间,但可以计算出+-127的两个数之积.传统算法需要至少127×127个存储空间. 查找表模块的建立: module lut_ ...
- keystone 手动建立租户,用户,角色,服务,端口
建立租户: root@cloud:~# keystone tenant-create --name=admin WARNING: Bypassing authentication using a to ...
- 手动建立数据库连接的BaseDAO
package com.chinasoft.julong.dao; import java.sql.Connection; import java.sql.DriverManager; import ...
- Linux中yum手动安装、手动建立仓库文件夹关联实现关联包自动安装、yum相关命令使用
yum(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及SUSE中的Shell前端软件包管理器.基於RPM包管理,能够从指 ...
- LINUX 手动建立SWAP文件及删除
原文:http://blog.itpub.net/7728585/viewspace-670175/ 1. 确定swap文件的大小,单位为M.将该值乘以1024得到块大小.例如,64MB的swap文件 ...
- 【转】LINUX 手动建立SWAP文件及删除
如何在红帽 企业版Linux系统中添加swap文件? 解决方法: 1. 确定swap文件的大小,单位为M.将该值乘以1024得到块大小.例如,64MB的swap文件的块大小是65536. 2. 在ro ...
- Ubuntu14.04下手动建立快捷方式
先在桌面创建一个文件:文件内容如下 [Desktop Entry]Encoding=UTF-8Name=eclipseComment=eclipse ideExec=/home/mars/eclips ...
随机推荐
- POJ 3468.A Simple Problem with Integers-线段树(成段增减、区间查询求和)
POJ 3468.A Simple Problem with Integers 这个题就是成段的增减以及区间查询求和操作. 代码: #include<iostream> #include& ...
- HDU 1754.I Hate It-完全版线段树(单点替换、区间最值)
HDU1754.I Hate It 直接模板就可以了 代码: //B #include<iostream> #include<cstdio> #include<cstri ...
- Python的程序结构[2] -> 类/Class[6] -> 内建类 map
内建类map / Built-in Type map 关于内建类 map 是一个内建的类,能够返回一个 map 的 obj.map 的第一个参数为一个可执行函数,后续参数均为可迭代对象,map 会分别 ...
- 代理Delegation
package com.ctl.test; class Person { private int id; private String name; public int getId() { retur ...
- memcache运行机制(转)
网上其实有很多文章说明了memcached是如何运作的,特别是底层的内存分配是如何运作的.我参考过很多资料,比较有启发意义的有几个: 首先是官方的英文资料,虽然文章太多.很难看懂,我个人觉得说得也不是 ...
- 【机器学习】Mahout算法集
在Mahout实现的机器学习算法见下表 算法类 算法名 中文名 分类算法 Logistic Regression 逻辑回归 Bayesian 贝叶斯 SVM 支持向量机 Perceptron 感知器算 ...
- Git的微操作
合并分支代码,简单操作: 1.切换到master主干代码 2.到git repositories 视图,点击需要合并的分支,例如v1.1.9 点击merge 进行合并 3.然后push to Upst ...
- 查找文件命令find总结以及查找大文件
find / -name *** 示例如下: [dinpay@zk-spark-01 spark]$ find /home/ll -name slaves /home/ll/spark/conf/sl ...
- autocomplete属性在谷歌浏览器不起作用
大家都知道autocomplete属性是表单字段中的HTML5新属性,该属性有两种状态值,分别为"on" 和 "off",该属性可省略:省略属性值后默认值为&q ...
- selenium执行报错:Process refused to die after 10 seconds, and couldn't taskkill it
十二月 02, 2015 5:16:56 下午 org.openqa.selenium.os.ProcessUtils killWinProcess 警告: Process refused to di ...