Skip to content

Commit 3b9855c

Browse files
committed
update
1 parent 5d58fe8 commit 3b9855c

File tree

6 files changed

+45
-23
lines changed

6 files changed

+45
-23
lines changed

README.en.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
# react-scroll-log-text
22

3-
> 这是一个react文字滚动插件
43

54
[![NPM](https://img.shields.io/npm/v/react-scroll-log-text.svg)](https://www.npmjs.com/package/react-scroll-log-text) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
65

7-
[Document](README.en.md)
6+
<img src="example/demo.gif">
87

9-
## 安装
8+
9+
[文档](README.md)
10+
11+
## Install
1012

1113
```bash
12-
npm install --save react-scroll-log-text // or yarn add react-scroll-log-text
14+
yarn add react-scroll-log-text // or npm install --save react-scroll-log-text
1315
```
1416

15-
## 使用
17+
## Usage
1618

1719
```jsx
1820
import React, { Component } from 'react'
@@ -29,11 +31,15 @@ class Example extends Component {
2931

3032
## Props
3133

32-
Available props for component:
34+
|name | desc | type | default |
35+
|---|---|---|---|
36+
| `data` | data | Array or Object | [] |
37+
| `animateSpeed` | Animation scroll transition time, unit: second | Number | 1 |
38+
| `length` | Data larger than 'length' starts to scroll | Number | 5 |
39+
| `liStyle` | The sytle of the li label (the pixel must be added with the unit px) | Object | |
40+
| `childrenFc` | Custom rendering item components, such as when data is multiple fields | function | |
3341

34-
|Name|Descr|Default|
35-
|---|---|---|
36-
| `speed` | Set the animation speed (0-100) | 100 |
42+
[example](example)
3743

3844
## License
3945

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
# react-scroll-log-text
22

3-
> 这是一个react文字滚动插件
3+
> react js 文字滚动插件
44
55
[![NPM](https://img.shields.io/npm/v/react-scroll-log-text.svg)](https://www.npmjs.com/package/react-scroll-log-text) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
66

7-
[Document](README.en.md)
8-
97
<img src="example/demo.gif">
10-
![alt text](https://github.com/rfw/react-scroll-log-text/blob/main/example/demo.gif?raw=true)
8+
9+
10+
[Document](README.en.md)
1111

1212
## 安装
1313

1414
```bash
15-
npm install --save react-scroll-log-text // or yarn add react-scroll-log-text
15+
yarn add react-scroll-log-text // or npm install --save react-scroll-log-text
1616
```
1717

1818
## 使用

example/demo.gif

510 KB
Loading

example/src/App.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState, useEffect } from 'react'
2-
2+
import './index.css';
33
import ScrollText from 'react-scroll-log-text'
44
import 'react-scroll-log-text/dist/index.css'
55

@@ -14,12 +14,14 @@ const App = () => {
1414
}, 3000);
1515
}, [])
1616

17-
return <ScrollText
18-
data={data}
19-
length={4}
20-
liStyle={{lineHeight: '40px'}}
21-
childrenFc={(v) => <div>={v}=</div>}
22-
/>
17+
return <div className='demo-box'>
18+
<ScrollText
19+
data={data}
20+
length={7}
21+
liStyle={{lineHeight: '30px'}}
22+
childrenFc={(v) => <div>This value is : {v}</div>}
23+
/>
24+
</div>
2325
}
2426

2527
export default App

example/src/index.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,23 @@ body {
66
sans-serif;
77
-webkit-font-smoothing: antialiased;
88
-moz-osx-font-smoothing: grayscale;
9+
display: flex;
10+
height: 100vh;
11+
justify-content: center;
12+
align-items: center;
913
}
1014

1115
code {
1216
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
1317
monospace;
1418
}
19+
20+
.demo-box{
21+
padding: 5px;
22+
border-radius: 5px;
23+
border: 1px solid #ccc;
24+
25+
width: 300px;
26+
height: 208px;
27+
overflow: hidden;
28+
}

src/styles.module.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
}
88
#scrollList li {
99
list-style: none;
10-
font-size: 12px;
10+
font-size: 14px;
1111
white-space: nowrap;
1212
overflow: hidden;
1313
text-overflow: ellipsis;
1414
line-height: 30px;
1515
margin: 0;
1616
padding: 0;
17-
}
17+
}

0 commit comments

Comments
 (0)