react-fancy-circular-carousel 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FancyCarousel.css +0 -2
- package/README.md +23 -15
- package/assets/preview2.gif +0 -0
- package/package.json +1 -1
package/FancyCarousel.css
CHANGED
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center"><p align="center"><a href="https://www.npmjs.com/package/react-fancy-circular-carousel"><img src="https://github.com/ninadsutrave/react-fancy-circular-carousel/blob/master/dist/assets/React.webp?raw=true" alt="React Logo - Carousel UI Component" width="140px" /></a></p></div>
|
|
2
2
|
|
|
3
|
-
<h1 align="center">React
|
|
3
|
+
<h1 align="center">React Circular Carousel Component</h1>
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
$ npm install react-fancy-circular-carousel
|
|
15
15
|
|
|
16
|
-
Include the styles by importing
|
|
16
|
+
Include the styles by importing FancyCarousel.css
|
|
17
17
|
|
|
18
18
|
```jsx
|
|
19
19
|
import '../node_modules/react-fancy-circular-carousel/FancyCarousel.css';
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
## Quickstart
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
### Parameters
|
|
25
25
|
|
|
26
26
|
| **Parameter** | **Type** | **Description** |
|
|
27
27
|
|:---|:---|:---|
|
|
@@ -46,7 +46,10 @@
|
|
|
46
46
|
| navigationButtonStyling | React.CSSProperties | `optional` Custom styling for navigation buttons |
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
### Usage
|
|
50
|
+
|
|
49
51
|
```jsx
|
|
52
|
+
|
|
50
53
|
import React from "react";
|
|
51
54
|
|
|
52
55
|
import FancyCarousel from "react-fancy-circular-carousel";
|
|
@@ -57,22 +60,22 @@ import image2 from './assets/image2.png';
|
|
|
57
60
|
import image3 from './assets/image3.png';
|
|
58
61
|
import image4 from './assets/image4.png';
|
|
59
62
|
|
|
60
|
-
|
|
61
63
|
const YourComponent = () => (
|
|
62
64
|
|
|
63
|
-
const
|
|
65
|
+
const images = [image1, image2, image3, image4];
|
|
64
66
|
|
|
65
67
|
return <div className="carousel">
|
|
66
|
-
<FancyCarousel images={
|
|
68
|
+
<FancyCarousel images={images} />
|
|
67
69
|
</div>
|
|
68
70
|
);
|
|
69
71
|
|
|
70
72
|
export default YourComponent;
|
|
71
73
|
```
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
### Retrieve focus element
|
|
74
76
|
|
|
75
77
|
Utility using which one can know which element is currently at focus and may add relevant components around it.
|
|
78
|
+
|
|
76
79
|
For eg. if the carousel portrays images of cities, this feature may help you update the description in the information box along side the carousel.
|
|
77
80
|
|
|
78
81
|
```jsx
|
|
@@ -91,11 +94,11 @@ const YourComponent = () => (
|
|
|
91
94
|
// the focus element would be the array index of the currently image at focus
|
|
92
95
|
const [focusElement, setFocusElement] = useState(0);
|
|
93
96
|
|
|
94
|
-
const
|
|
97
|
+
const images = [image1, image2, image3, image4];
|
|
95
98
|
const info = ['Delhi', 'Mumbai', 'Bengaluru', 'Kolkata'];
|
|
96
99
|
|
|
97
100
|
return <div className="carousel">
|
|
98
|
-
<FancyCarousel images={
|
|
101
|
+
<FancyCarousel images={images} setFocusElement={setFocusElement}/>
|
|
99
102
|
<div className="info-box-wrapper">
|
|
100
103
|
<p> {info[focusElement]} </p>
|
|
101
104
|
</div>
|
|
@@ -105,9 +108,10 @@ const YourComponent = () => (
|
|
|
105
108
|
export default YourComponent;
|
|
106
109
|
```
|
|
107
110
|
|
|
108
|
-
|
|
111
|
+
### Customisations
|
|
109
112
|
|
|
110
113
|
Customise the carousel to your needs such as modifying the carousel size, image size, adding styling such as drop shadow, adding auto rotate, etc
|
|
114
|
+
|
|
111
115
|
The focusElementStyling and navigationButtonStyling props are of type React.CSSProperties, which is essentially a JavaScript object containing camelcased CSS properties and their corresponding values.
|
|
112
116
|
|
|
113
117
|
To know more check the official documentation [here](https://legacy.reactjs.org/docs/dom-elements.html#style).
|
|
@@ -125,11 +129,11 @@ import image4 from './assets/image4.png';
|
|
|
125
129
|
|
|
126
130
|
const YourComponent = () => (
|
|
127
131
|
|
|
128
|
-
const
|
|
132
|
+
const images = [image1, image2, image3, image4];
|
|
129
133
|
|
|
130
134
|
return <div className="carousel">
|
|
131
135
|
<FancyCarousel
|
|
132
|
-
images={
|
|
136
|
+
images={images}
|
|
133
137
|
carouselRadius={400}
|
|
134
138
|
peripheralImageRadius={100}
|
|
135
139
|
centralImageRadius={200}
|
|
@@ -146,14 +150,18 @@ export default YourComponent;
|
|
|
146
150
|
|
|
147
151
|
## Preview
|
|
148
152
|
|
|
153
|
+
With navigators
|
|
154
|
+
|
|
149
155
|

|
|
150
156
|
|
|
157
|
+
With auto rotation
|
|
158
|
+
|
|
151
159
|

|
|
152
160
|
|
|
153
|
-
##
|
|
161
|
+
## Github Repo
|
|
154
162
|
|
|
155
|
-
[
|
|
156
|
-
Try it out for yourselves and ⭐
|
|
163
|
+
[Github Repo](https://github.com/ninadsutrave/react-fancy-circular-carousel)
|
|
164
|
+
Try it out for yourselves and ⭐ the repo if you like it!
|
|
157
165
|
|
|
158
166
|
## License
|
|
159
167
|
|
package/assets/preview2.gif
CHANGED
|
Binary file
|
package/package.json
CHANGED