-
Notifications
You must be signed in to change notification settings - Fork 292
/
Copy pathCustomArrows.js
44 lines (41 loc) · 1.18 KB
/
CustomArrows.js
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
33
34
35
36
37
38
39
40
41
42
43
44
import * as React from "react";
const CustomLeftArrow = ({ onClick }) => (
<i onClick={() => onClick()} className="custom-left-arrow" />
);
const CustomRightArrow = ({ onClick }) => {
return <i className="custom-right-arrow" onClick={() => onClick()} />;
};
const CustomButtonGroup = ({ next, previous, goToSlide, carouselState }) => {
const { totalItems, currentSlide } = carouselState;
return (
<div className="custom-button-group">
<div>Current slide is {currentSlide}</div>
<button onClick={() => previous()}>Previous slide</button>
<button onClick={() => next()}>Next slide</button>
<button
onClick={() => goToSlide(Math.floor(Math.random() * totalItems + 1))}
>
Go to a random slide
</button>
</div>
);
};
const CustomButtonGroupAsArrows = ({ next, previous }) => {
return (
<div
style={{
textAlign: "center",
}}
>
<h4>These buttons can be positioned anywhere you want on the screen</h4>
<button onClick={previous}>Prev</button>
<button onClick={next}>Next</button>
</div>
);
};
export {
CustomLeftArrow,
CustomRightArrow,
CustomButtonGroup,
CustomButtonGroupAsArrows,
};