-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontributing.md
More file actions
32 lines (20 loc) · 1.25 KB
/
contributing.md
File metadata and controls
32 lines (20 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# Contributing
Send a PR or raise an issue to:
- Report/Fix a bug.
- Suggest/Improve the documentation
- Request/Develop a new feature.
## Pull request
Pull requests are extremely welcome. To start up your local development:
- cd app
- npm install -- package.json
- npm run dev
## Technical guide.
The most difficult part of building this lib is for the infinite mode. For non-infinite mode, its very easy, we simply calculate the length of the children as well as calculating the total width of the container, and then the following:
```
const width = containerWidth / this.props.children.length;
return children.map(child => <li style={{ width: width }}>{child}</li> )
```
And this is what's behind of hood pretty much.
For for the infinite mode, we need to clone the children on the client-side, the algorithm that is used in this lib can be found at `utils/clones` with the name `getClones()`.
We also need to care about the timing of canceling/enabling the animation, there are two functions for this, can be found at `utils/clones` with the name `setClones()` and `correctClonesPosition()` in `Carousel.tsx` in the `componentDidUpdate()` method.
For server-side rendering, we use `flex-basis` to set the width of the item, and on the client-side we switch to `width`