Skip to content

Commit 540ce60

Browse files
author
wfbn8821
committed
fix webpack packaging and quick guide
1 parent 14b615c commit 540ce60

File tree

3 files changed

+49
-2
lines changed

3 files changed

+49
-2
lines changed

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,47 @@
11
# react-card-scroll
2+
A React component to horizontally navigate between components of same width (Bootstrap cards for example)
3+
It is responsive and support card adds and removes with `getCardCount` function.
4+
For example you can have 3 cards on the screen and there is a total of 5 cards, you can navigate right or left to the cards not displayed
5+
You resize and you display only 2 cards, you can still navigate to the other cards
6+
7+
## Installation
8+
```bash
9+
npm i -S react-card-scroll
10+
```
11+
12+
## Usage
13+
14+
```jsx
15+
<CardScroll getCardWidth={getCardWidth} getCardCount={getCardCount}>
16+
<div className="col-sm-6 col-md-4">
17+
</div>
18+
19+
<div className="col-sm-6 col-md-4">
20+
</div>
21+
22+
<div className="col-sm-6 col-md-4">
23+
</div>
24+
25+
<div className="col-sm-6 col-md-4">
26+
</div>
27+
28+
<div className="col-sm-6 col-md-4">
29+
</div>
30+
</CardScroll>
31+
```
32+
33+
From parent, trigger navigation when you want (add, remove cards):
34+
35+
```javascript
36+
this.refs.cardScroll.scrollCards({toLeft: true, number:1})
37+
```
38+
39+
## TODO
40+
- [ ] Tests
41+
- [ ] Example
42+
- Features
43+
- [ ] CSS arrows
44+
- [ ] Disable arrows if unable to navigate
45+
- Technical
46+
- [ ] CSS loader
47+
- [ ] Improve packaging

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-card-scroll",
3-
"version": "0.2.1",
3+
"version": "0.2.2",
44
"description": "A React component to navigate horizontally between cards of same width",
55
"main": "dist/bundle.js",
66
"scripts": {

webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ module.exports = {
44
entry: "./src/index.js",
55
output: {
66
path: path.join(__dirname, './dist'),
7-
filename: "bundle.js"
7+
filename: "bundle.js",
8+
libraryTarget: "commonjs2"
89
},
910
module: {
1011
loaders: [

0 commit comments

Comments
 (0)