From 945a33763f26be0504f2a5fcc3b4f621f64daf38 Mon Sep 17 00:00:00 2001 From: Boyuzhou <386607913@qq.com> Date: Mon, 10 Oct 2016 16:36:03 +0800 Subject: [PATCH 1/4] add sass --- react编码规范.md | 1 + sass环境依赖解决.md | 32 ++++++++++++++++++++++++++ 如何写一个标准的react组件.md | 4 +++- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 sass环境依赖解决.md diff --git a/react编码规范.md b/react编码规范.md index cee3ed6..812d5c8 100644 --- a/react编码规范.md +++ b/react编码规范.md @@ -26,6 +26,7 @@ - 代码规范使用 [airbnb规范](https://github.com/airbnb/javascript/tree/master/react) ## 样式规范 +- 组件样式使用sass编写,公用样式使用bee-core包 - 组件样式调用,使用classnames模块,进行样式处理,使用className调用 - 组件内部使用clsPrefix为样式前缀 ```javascript diff --git a/sass环境依赖解决.md b/sass环境依赖解决.md new file mode 100644 index 0000000..1f22c2d --- /dev/null +++ b/sass环境依赖解决.md @@ -0,0 +1,32 @@ +# sass环境依赖 + +## 安装Ruby +sass依赖Ruby环境,所以需要先安装Ruby +- 下载地址(http://rubyinstaller.org/downloads)[http://rubyinstaller.org/downloads] +- 注意事项:安装时,最好勾选Add Ruby executables to your PATH这个选项,添加环境变量。 +- 查看ruby是否正确安装,在命令窗口使用ruby -v查看版本号来确认是否正确安装 + + +## 安装gulp-sass +generator-tinper-bee是我们编写组件的脚手架产出工具,它产出的脚手架使用gulp-sass编译sass, +gulp-sass依赖于node-sass,node-sass由于某些网络原因,我们可能无法下载 +所以请使用cnpm下载node-sass +``` +npm install -g cnpm + +cnpm install --save-dev node-sass + +``` +接着下载gulp-sass +``` +cnpm install --save-dev gulp-sass +``` + + + +## sass用法 +请移步参考: +(http://www.w3cplus.com/sassguide/)[http://www.w3cplus.com/sassguide/] +(http://sass-lang.com/documentation/file.SASS_REFERENCE.html)[http://sass-lang.com/documentation/file.SASS_REFERENCE.html] + +(关于安装gulp-sass失败的问题解决)[http://blog.csdn.net/jimmyhandy/article/details/50723174] diff --git a/如何写一个标准的react组件.md b/如何写一个标准的react组件.md index 89aa7e6..15c6f77 100644 --- a/如何写一个标准的react组件.md +++ b/如何写一个标准的react组件.md @@ -2,6 +2,7 @@ #### 环境依赖 - 需要安装node 4.0版本及以上, npm版本最好3.0以上 +- (sass环境依赖)[] ### 一、生成组件脚手架 #### 1、下载 @@ -33,10 +34,11 @@ API介绍 ``` -demo -ButtonDemo.js - -ButtonDemo.less + -ButtonDemo.scss -index.js -src -Button.js + -Button.scss -index.js -test -setup.js From 58d90362caa596dcbe7a2b82720f724e66a72d94 Mon Sep 17 00:00:00 2001 From: Boyuzhou <386607913@qq.com> Date: Mon, 10 Oct 2016 16:45:37 +0800 Subject: [PATCH 2/4] change link --- react编码规范.md | 2 +- sass环境依赖解决.md | 8 +++----- 如何写一个标准的react组件.md | 5 ++++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/react编码规范.md b/react编码规范.md index 812d5c8..e643209 100644 --- a/react编码规范.md +++ b/react编码规范.md @@ -26,7 +26,7 @@ - 代码规范使用 [airbnb规范](https://github.com/airbnb/javascript/tree/master/react) ## 样式规范 -- 组件样式使用sass编写,公用样式使用bee-core包 +- 组件样式使用sass编写,公用样式使用tinper-bee-core包,请阅读[tinper-bee-core文档](https://github.com/tinper-bee/tinper-bee-core) - 组件样式调用,使用classnames模块,进行样式处理,使用className调用 - 组件内部使用clsPrefix为样式前缀 ```javascript diff --git a/sass环境依赖解决.md b/sass环境依赖解决.md index 1f22c2d..055b217 100644 --- a/sass环境依赖解决.md +++ b/sass环境依赖解决.md @@ -2,7 +2,7 @@ ## 安装Ruby sass依赖Ruby环境,所以需要先安装Ruby -- 下载地址(http://rubyinstaller.org/downloads)[http://rubyinstaller.org/downloads] +- 下载地址[http://rubyinstaller.org/downloads](http://rubyinstaller.org/downloads) - 注意事项:安装时,最好勾选Add Ruby executables to your PATH这个选项,添加环境变量。 - 查看ruby是否正确安装,在命令窗口使用ruby -v查看版本号来确认是否正确安装 @@ -26,7 +26,5 @@ cnpm install --save-dev gulp-sass ## sass用法 请移步参考: -(http://www.w3cplus.com/sassguide/)[http://www.w3cplus.com/sassguide/] -(http://sass-lang.com/documentation/file.SASS_REFERENCE.html)[http://sass-lang.com/documentation/file.SASS_REFERENCE.html] - -(关于安装gulp-sass失败的问题解决)[http://blog.csdn.net/jimmyhandy/article/details/50723174] +[http://www.w3cplus.com/sassguide/](http://www.w3cplus.com/sassguide/) +[http://sass-lang.com/documentation/file.SASS_REFERENCE.html](http://sass-lang.com/documentation/file.SASS_REFERENCE.html) diff --git a/如何写一个标准的react组件.md b/如何写一个标准的react组件.md index 15c6f77..cc3e5de 100644 --- a/如何写一个标准的react组件.md +++ b/如何写一个标准的react组件.md @@ -2,7 +2,7 @@ #### 环境依赖 - 需要安装node 4.0版本及以上, npm版本最好3.0以上 -- (sass环境依赖)[] +- [sass环境依赖](https://github.com/tinper-bee/react-components-docs/blob/master/sass%E7%8E%AF%E5%A2%83%E4%BE%9D%E8%B5%96%E8%A7%A3%E5%86%B3.md) ### 一、生成组件脚手架 #### 1、下载 @@ -63,6 +63,9 @@ API介绍 - 根目录 中的 html 不可修改,通过 js 中的 jsx 渲染页面,通过 require css 引入 css。 - 开发中用到其他公共库,通过 `npm install --save` 以及 `npm install --save-dev` 来安装 +##### 代码书写规范 +[react编码规范](https://github.com/tinper-bee/react-components-docs/blob/master/react%E7%BC%96%E7%A0%81%E8%A7%84%E8%8C%83.md) +[react组件测试流程和规范](https://github.com/tinper-bee/react-components-docs/blob/master/react%E7%BB%84%E4%BB%B6%E6%B5%8B%E8%AF%95%E6%B5%81%E7%A8%8B%E5%92%8C%E8%A7%84%E8%8C%83.md) ##### 开发调试 From 92c56c145cb6d11ef36f3269354d2f635c5d26c3 Mon Sep 17 00:00:00 2001 From: Boyuzhou <386607913@qq.com> Date: Tue, 11 Oct 2016 13:30:13 +0800 Subject: [PATCH 3/4] fix bug --- react编码规范.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/react编码规范.md b/react编码规范.md index e643209..2cac1bc 100644 --- a/react编码规范.md +++ b/react编码规范.md @@ -49,9 +49,9 @@ const classString = classNames('hide', class1, class2); ```javascript //引入依赖 -let React = require('react'); -let ReactDOM = require('react-dom'); -let classnames = require('classnames'); +import React from 'react'; +import ReactDOM from'react-dom'; +import classnames from 'classnames'; //定义prop检验 const propTypes = { @@ -84,7 +84,7 @@ class Button extends React.Component { Button.propTypes = propTypes; Button.defaultProps = defaultProps; -module.exports = Button; +export default Button; ``` From feb59360d47bff63da5a335c643dc075171855ff Mon Sep 17 00:00:00 2001 From: Boyuzhou <386607913@qq.com> Date: Tue, 11 Oct 2016 13:35:12 +0800 Subject: [PATCH 4/4] add working --- 如何写一个标准的react组件.md | 5 +++-- 现有组件及待开发.md | 12 ++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/如何写一个标准的react组件.md b/如何写一个标准的react组件.md index cc3e5de..869c491 100644 --- a/如何写一个标准的react组件.md +++ b/如何写一个标准的react组件.md @@ -18,8 +18,9 @@ cd button yo tinper-bee --port=8000 --author=yonyou ``` API介绍 -| 参数 | 说明 | 默认值 | -| ------------- |:-------------:| -----:| + +| 参数 | 说明 | 默认值 | +|:------------ |:-------------:| -----:| | port | 开发时服务监听端口 | 8000 | | author | 作者名字 | 空字符串 | | beeVersion | 版本号 | 0.0.1 | diff --git a/现有组件及待开发.md b/现有组件及待开发.md index 0749ecf..87a7406 100644 --- a/现有组件及待开发.md +++ b/现有组件及待开发.md @@ -4,10 +4,16 @@ - button +### 正在开发组件 +|组件|开发者| +|:--|--:| +|dropdown|boyuhzou| +|badge|ahua| +|switch|wanghongxiang| + + ### 待开发组件 - - #### 基本组件 - radio @@ -17,7 +23,6 @@ - loading - multilang - progress -- switch - textfield - tooltip - input @@ -25,7 +30,6 @@ - label - image - message -- badge - step - breadcrumb - panel