Skip to content

Commit 1145e86

Browse files
committed
初始化rc-rate项目
0 parents  commit 1145e86

25 files changed

+738
-0
lines changed

.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# Unix-style newlines with a newline ending every file
5+
[*.{js,css}]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
indent_style = space
9+
indent_size = 2

.gitignore

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
*.iml
2+
*.log
3+
.idea
4+
.ipr
5+
.iws
6+
*~
7+
~*
8+
*.diff
9+
*.patch
10+
*.bak
11+
.DS_Store
12+
Thumbs.db
13+
.project
14+
.*proj
15+
.svn
16+
*.swp
17+
*.swo
18+
*.pyc
19+
*.pyo
20+
node_modules
21+
.cache
22+
*.css
23+
build
24+
lib

.travis.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
language: node_js
2+
3+
sudo: false
4+
5+
notifications:
6+
email:
7+
8+
9+
node_js:
10+
- 4.0.0
11+
12+
before_install:
13+
- |
14+
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
15+
then
16+
echo "Only docs were updated, stopping build process."
17+
exit
18+
fi
19+
npm install mocha-phantomjs -g
20+
phantomjs --version
21+
script:
22+
- |
23+
if [ "$TEST_TYPE" = test ]; then
24+
npm test
25+
else
26+
npm run $TEST_TYPE
27+
fi
28+
env:
29+
matrix:
30+
- TEST_TYPE=lint
31+
- TEST_TYPE=browser-test
32+
- TEST_TYPE=browser-test-cover
33+
- TEST_TYPE=saucelabs
34+
35+
36+
matrix:
37+
allow_failures:
38+
- env: "TEST_TYPE=saucelabs"

HISTORY.md

Whitespace-only changes.

README.md

+178
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# rc-rate
2+
---
3+
4+
React Rate Component
5+
6+
7+
[![NPM version][npm-image]][npm-url]
8+
[![build status][travis-image]][travis-url]
9+
[![Test coverage][coveralls-image]][coveralls-url]
10+
[![gemnasium deps][gemnasium-image]][gemnasium-url]
11+
[![node version][node-image]][node-url]
12+
[![npm download][download-image]][download-url]
13+
[![Sauce Test Status](https://saucelabs.com/buildstatus/rc-rate)](https://saucelabs.com/u/rc-rate)
14+
15+
[![Sauce Test Status](https://saucelabs.com/browser-matrix/rc-rate.svg)](https://saucelabs.com/u/rc-rate)
16+
17+
[npm-image]: http://img.shields.io/npm/v/rc-rate.svg?style=flat-square
18+
[npm-url]: http://npmjs.org/package/rc-rate
19+
[travis-image]: https://img.shields.io/travis/react-component/rate.svg?style=flat-square
20+
[travis-url]: https://travis-ci.org/react-component/rate
21+
[coveralls-image]: https://img.shields.io/coveralls/react-component/rate.svg?style=flat-square
22+
[coveralls-url]: https://coveralls.io/r/react-component/rate?branch=master
23+
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/rate.svg?style=flat-square
24+
[gemnasium-url]: https://gemnasium.com/react-component/rate
25+
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square
26+
[node-url]: http://nodejs.org/download/
27+
[download-image]: https://img.shields.io/npm/dm/rc-rate.svg?style=flat-square
28+
[download-url]: https://npmjs.org/package/rc-rate
29+
30+
31+
## Browser Support
32+
33+
|![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png)|
34+
| --- | --- | --- | --- | --- |
35+
| IE 8+ ✔ | Chrome 31.0+ ✔ | Firefox 31.0+ ✔ | Opera 30.0+ ✔ | Safari 7.0+ ✔ |
36+
37+
## Screenshots
38+
39+
<img src="" width="288"/>
40+
41+
42+
## Development
43+
44+
```
45+
npm install
46+
npm start
47+
```
48+
49+
## Example
50+
51+
http://localhost:8000/examples/
52+
53+
54+
online example: http://react-component.github.io/rate/examples/
55+
56+
57+
## Feature
58+
59+
* support ie8,ie8+,chrome,firefox,safari
60+
61+
### Keyboard
62+
63+
64+
## install
65+
66+
67+
[![rc-rate](https://nodei.co/npm/rc-rate.png)](https://npmjs.org/package/rc-rate)
68+
69+
70+
## Usage
71+
72+
```js
73+
var Rate = require('rc-rate');
74+
var React = require('react');
75+
React.render(<Rate />, container);
76+
```
77+
78+
## API
79+
80+
### props
81+
82+
<table class="table table-bordered table-striped">
83+
<thead>
84+
<tr>
85+
<th style="width: 100px;">name</th>
86+
<th style="width: 50px;">type</th>
87+
<th style="width: 50px;">default</th>
88+
<th>description</th>
89+
</tr>
90+
</thead>
91+
<tbody>
92+
<tr>
93+
<td>starNum</td>
94+
<td>number</td>
95+
<td>5</td>
96+
<td>总共需要显示星星的数量</td>
97+
</tr>
98+
<tr>
99+
<td>initNum</td>
100+
<td>number</td>
101+
<td>0</td>
102+
<td>起始高亮星星的数值</td>
103+
</tr>
104+
<tr>
105+
<td>half</td>
106+
<td>bool</td>
107+
<td>false</td>
108+
<td>是否支持半颗星的情况</td>
109+
</tr>
110+
<tr>
111+
<td>style</td>
112+
<td>object</td>
113+
<td>{}</td>
114+
<td>星星的样式必须符合react的style样式</td>
115+
</tr>
116+
<tr>
117+
<td>color</td>
118+
<td>string</td>
119+
<td>"#ff8208"</td>
120+
<td>星星的颜色,默认黄色</td>
121+
</tr>
122+
<tr>
123+
<td>size</td>
124+
<td>number</td>
125+
<td>15</td>
126+
<td>默认星星的大小,默认15px</td>
127+
</tr>
128+
<tr>
129+
<td>useHover</td>
130+
<td>bool</td>
131+
<td>false</td>
132+
<td>是否支持hover选择数量(必须disableHover为false的情况下,会覆盖click事件),</td>
133+
</tr>
134+
<tr>
135+
<td>disableHover</td>
136+
<td>bool</td>
137+
<td>false</td>
138+
<td>是否不开启点击事件</td>
139+
</tr>
140+
<tr>
141+
<td>disableClick</td>
142+
<td>bool</td>
143+
<td>false</td>
144+
<td>是否不开启hover事件</td>
145+
</tr>
146+
<tr>
147+
<td>onHover</td>
148+
<td>func</td>
149+
<td>function(){}</td>
150+
<td>鼠标在星星上移动的时候的事件</td>
151+
</tr>
152+
<tr>
153+
<td>onClick</td>
154+
<td>bool</td>
155+
<td>false</td>
156+
<td>鼠标点击星星的时候的事件</td>
157+
</tr>
158+
<tr>
159+
<td>onChange</td>
160+
<td>bool</td>
161+
<td>false</td>
162+
<td>星星变化时候的事件</td>
163+
</tr>
164+
</tbody>
165+
</table>
166+
167+
168+
## Test Case
169+
170+
http://localhost:8000/tests/runner.html?coverage
171+
172+
## Coverage
173+
174+
http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage
175+
176+
## License
177+
178+
rc-rate is released under the MIT license.

assets/extend.less

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@prefixClass: extend;
2+
@font-face {
3+
font-family: 'jui';
4+
src: url('https://at.alicdn.com/t/font_1449147263_3487175.eot'); /* IE9*/
5+
src: url('https://at.alicdn.com/t/font_1449147263_3487175.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
6+
url('https://at.alicdn.com/t/font_1449147263_3487175.woff') format('woff'), /* chrome、firefox */
7+
url('https://at.alicdn.com/t/font_1449147263_3487175.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
8+
url('https://at.alicdn.com/t/font_1449147263_3487175.svg#iconfont') format('svg'); /* iOS 4.1- */
9+
}
10+
.iconfont {
11+
font-family: 'jui','rei';
12+
font-weight: normal;
13+
font-style: normal;
14+
cursor: default;
15+
-webkit-font-smoothing: antialiased; /*解决safair和chrome被加粗*/
16+
-webkit-text-stroke-width: 0.2px; /*解决chrome锯齿*/
17+
}
18+
.@{prefixClass}-star-wrapper{
19+
list-style: none;
20+
font-size: 12px;
21+
display: inline-block;
22+
}
23+
.@{prefixClass}-star-wrapper li{
24+
display: inline-block;
25+
cursor: pointer;
26+
margin-right:5px;
27+
}
28+
.@{prefixClass}-half-star::before{
29+
content:"\e610";
30+
}
31+
.@{prefixClass}-all-star::before{
32+
content: "\e60f";
33+
}
34+
.@{prefixClass}-zero-star::before{
35+
content: "\e60e";
36+
}
37+
.extend-starbar{
38+
position:relative;
39+
display:inline-block;
40+
}
41+
.warn-info{
42+
display:block;
43+
position:absolute;
44+
line-height:30px;
45+
background:#fff;
46+
border:1px solid #ff8208;
47+
padding:5px;
48+
top:0;
49+
left:140px;
50+
}
51+
.warn-info::before{
52+
position:absolute;
53+
54+
}

assets/index.less

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
@prefixClass: rc;
2+
@font-face {
3+
font-family: 'jui';
4+
src: url('https://at.alicdn.com/t/font_1449147263_3487175.eot'); /* IE9*/
5+
src: url('https://at.alicdn.com/t/font_1449147263_3487175.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
6+
url('https://at.alicdn.com/t/font_1449147263_3487175.woff') format('woff'), /* chrome、firefox */
7+
url('https://at.alicdn.com/t/font_1449147263_3487175.ttf') format('truetype'), /* chrome、firefox、opera、Safari, Android, iOS 4.2+*/
8+
url('https://at.alicdn.com/t/font_1449147263_3487175.svg#iconfont') format('svg'); /* iOS 4.1- */
9+
}
10+
.iconfont {
11+
font-family: 'jui','rei';
12+
font-weight: normal;
13+
font-style: normal;
14+
cursor: default;
15+
-webkit-font-smoothing: antialiased; /*解决safair和chrome被加粗*/
16+
-webkit-text-stroke-width: 0.2px; /*解决chrome锯齿*/
17+
}
18+
.@{prefixClass}-star-wrapper{
19+
list-style: none;
20+
font-size: 12px;
21+
display: inline-block;
22+
}
23+
.@{prefixClass}-star-wrapper li{
24+
display: inline-block;
25+
cursor: pointer;
26+
margin-right:5px;
27+
}
28+
.@{prefixClass}-half-star::before{
29+
content:"\e610";
30+
}
31+
.@{prefixClass}-all-star::before{
32+
content: "\e60f";
33+
}
34+
.@{prefixClass}-zero-star::before{
35+
content: "\e60e";
36+
}

examples/change-all.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
placeholder

examples/change-all.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// use jsx to render html, do not modify simple.html
2+
import Rate from 'rc-rate';
3+
import React from 'react';
4+
import ReactDOM from 'react-dom';
5+
6+
var options = {
7+
'initNum': 3.5,
8+
'starNum': 20,
9+
'half': true,
10+
'style': {'backGround': '#000'},
11+
}
12+
13+
ReactDOM.render(<Rate {...options} />, document.getElementById('__react-content'));

examples/change-star.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
placeholder

examples/change-star.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// use jsx to render html, do not modify simple.html
2+
import Rate from 'rc-rate';
3+
import React from 'react';
4+
import ReactDOM from 'react-dom';
5+
6+
var options = {
7+
'color': '#0ae',
8+
'size': 20,
9+
'initNum': 3.8,
10+
}
11+
12+
ReactDOM.render(<Rate {...options} />, document.getElementById('__react-content'));

examples/extend_star.html

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
placeholder

0 commit comments

Comments
 (0)