Skip to content

Commit 83b0c22

Browse files
committed
Update readme and minor fixes
1 parent 48c7597 commit 83b0c22

8 files changed

Lines changed: 21 additions & 7 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pids
1515
*.pid
1616
*.seed
1717
*.pid.lock
18+
.DS_Store
1819

1920
# Directory for instrumented libs generated by jscoverage/JSCover
2021
lib-cov

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Stacked card carousal component with configurable 3D transition effect.
66

77
<img src="./demo/card-carousel.gif" width="300" />
88

9+
<img src="./demo/image-carousel.gif" width="300" />
10+
911
## Getting started
1012

1113
#### Install react-card-stack-carousel from NPM
@@ -22,7 +24,7 @@ yarn add react-card-stack-carousel
2224

2325
```tsx
2426
// import base styles at the top of your component
25-
import "react-card-stack-carousel/dist/styles.css";
27+
import "react-card-stack-carousel/styles/styles.css";
2628
```
2729

2830
## Usage
@@ -32,11 +34,11 @@ import "react-card-stack-carousel/dist/styles.css";
3234
```tsx
3335
import React from "react";
3436
import { StackedCarousel } from "react-card-stack-carousel";
35-
import "react-card-stack-carousel/dist/styles.css"; // import base styles
37+
import "react-card-stack-carousel/styles/styles.css"; // import base styles
3638

3739
export default function App() {
3840
// specify container height
39-
const containerHeight = 500;
41+
const containerHeight = 250;
4042

4143
return (
4244
<main className="container">
@@ -96,4 +98,5 @@ yarn dev
9698
## Todo
9799

98100
- [ ] Auto compute the container height based on height of the active card
101+
- [ ] Support touch/drag gesture based navigation
99102
- [ ] Plugin system to enable custom transition styles

demo/card-carousel.gif

535 KB
Loading

demo/image-carousel.gif

2.47 MB
Loading

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
],
1515
"include": [
1616
"src/**/*",
17-
"dist/**/*",
17+
"styles/**/*",
1818
"types/**/*"
1919
],
2020
"types": "types/index.d.ts",

playground/App.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
22
import { StackedCarousel } from "react-card-stack-carousel";
3-
import "react-card-stack-carousel/dist/styles.css";
3+
import "react-card-stack-carousel/styles/styles.css";
44

55
export default function App() {
66
const cardWidth = 200;

src/useCardStackCarousel.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ export const useCardStackCarousel = (config) => {
127127
};
128128

129129
const handleTransition = (nextDirection, nextTransition, getNextIndex) => {
130+
if (totalCount === 1) {
131+
return;
132+
}
133+
130134
direction.current = nextDirection;
131135
setTransitionState(nextTransition);
132136

src/styles.css renamed to styles/styles.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111

1212
.rcsc-nav-container {
1313
position: absolute;
14-
bottom: -25px;
14+
bottom: -40px;
1515
width: 100%;
1616
display: flex;
1717
justify-content: center;
1818
z-index: 10;
19-
background-color: #1f2937;
2019
}
2120

2221
.rcsc-nav-icon {
@@ -27,5 +26,12 @@
2726
height: 15px;
2827
border-radius: 50%;
2928
margin: 0 5px;
29+
padding: 8px;
3030
cursor: pointer;
31+
background-color: #374151;
32+
transition: background-color 0.3s;
33+
}
34+
35+
.rcsc-nav-icon:hover {
36+
background-color: #1e293b;
3137
}

0 commit comments

Comments
 (0)