Skip to content

Commit 8abdbc1

Browse files
author
wfbn8821
committed
update README with 2.0.0
1 parent 4471e04 commit 8abdbc1

File tree

1 file changed

+24
-17
lines changed

1 file changed

+24
-17
lines changed

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
# react-card-scroll
22
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.
3+
It is responsive and support dynamic card adds and removes.
44

5+
You decide how many cards will be simultaneously visible depending on screen size, in the bootstrap style. You can then navigate to the other cards depending on how you want to implement it. If you don't want to implement anything, you can use default arrows.
56

6-
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.
7-
You resize and you display only 2 cards, you can still navigate to the other cards.
7+
Visually you have a left stack of cards, visible cards in the middle, and a right stack.
88

9-
Navigation can also be triggered programmatically.
10-
11-
## New in 1.x
12-
No need to give card width and card count anymore
9+
## New in 2.x
10+
Using stacks instead of sliding cards out of the screen
11+
Doesn't use react-motion anymore
1312

1413
## Installation
1514
```bash
@@ -18,24 +17,33 @@ npm i -S react-card-scroll
1817

1918
## Usage
2019

21-
Import css ```~react-card-scroll/lib/assets/styles.css```
20+
Import css either in sass ```~react-card-scroll/lib/assets/styles.css``` or in javascript with webpack
21+
22+
Use bootstrap style to decide how many cards will be visible (just add ```rcs-```): ```rcs-col-*-*```. You don't have to include bootstrap.
23+
24+
Choose how you want to implement the navigation by using ```scrollCards({toLeft: true/false, number:*})```.For example, you can scroll when you click on a stack or when you wheel your mouse with the pointer on a card title.
25+
See the example: ```npm run example``` and open localhost:8081. And get inspiration from the source code.
2226

27+
You can know where a card is with the ```getCardOffset``` function in JavaScript, or with the CSS classes ```rcs-left-stack rcs-center rcs-right-stack```
2328

29+
Use arrows with props ```showArrows={true}```
30+
31+
## Some (very) basic usage
2432
```jsx
2533
<CardScroll ref="cardScroll">
26-
<div className="col-sm-6 col-md-4">
34+
<div className="rcs-col-sm-6 rcs-col-md-4">
2735
</div>
2836

29-
<div className="col-sm-6 col-md-4">
37+
<div className="rcs-col-sm-6 rcs-col-md-4">
3038
</div>
3139

32-
<div className="col-sm-6 col-md-4">
40+
<div className="rcs-col-sm-6 rcs-col-md-4">
3341
</div>
3442

35-
<div className="col-sm-6 col-md-4">
43+
<div className="rcs-col-sm-6 rcs-col-md-4">
3644
</div>
3745

38-
<div className="col-sm-6 col-md-4">
46+
<div className="rcs-col-sm-6 rcs-col-md-4">
3947
</div>
4048
</CardScroll>
4149
```
@@ -46,15 +54,14 @@ From parent, trigger navigation when you want (add or remove cards, click somewh
4654
this.refs.cardScroll.scrollCards({toLeft: true, number:1})
4755
```
4856

49-
50-
5157
## TODO
52-
- [ ] Tests
58+
- [x] Tests
5359
- [x] Example
5460
- Features
5561
- [x] CSS arrows
5662
- [x] Disable arrows if unable to navigate
57-
~~- [ ] Mouse scroll triggers horizontal scroll~~ (it is up to the user, see example)
63+
- [ ] ~~Mouse scroll triggers horizontal scroll~~ (it is up to the user, see example)
64+
- [x] Stacks
5865
- Fix
5966
- [x] Remove horizontal scroll bar
6067
- Technical

0 commit comments

Comments
 (0)