@kolserdav/swiper 4.3.0 → 4.3.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/pages/index.tsx DELETED
@@ -1,74 +0,0 @@
1
- /******************************************************************************************
2
- * Repository: https://github.com/kolserdav/react-swiper.git
3
- * File name: index.tsx
4
- * Author: Sergey Kolmiller
5
- * Email: <kolserdav@conhos.ru>
6
- * License: MIT
7
- * License text: The code is distributed as is. There are no guarantees regarding the functionality of the code or parts of it.
8
- * Copyright: kolserdav, All rights reserved (c)
9
- * Create Date: Fri Sep 06 2024 18:44:44 GMT+0700 (Krasnoyarsk Standard Time)
10
- ******************************************************************************************/
11
- import s from "@/styles/Home.module.css";
12
- import { GetSwipeHandler, Swipe, Swiper } from "@/src/components/Swiper";
13
- import { useEffect, useState } from "react";
14
-
15
- const COUNT = 6;
16
- const LAG = 25;
17
-
18
- const getNext: GetSwipeHandler = async (old) => {
19
- let id: any = old + 1;
20
- id = id <= COUNT ? id : 0;
21
- return new Promise((resolve) => {
22
- setTimeout(() => {
23
- resolve({
24
- id,
25
- children: <h1>Test {id}</h1>,
26
- });
27
- }, LAG);
28
- });
29
- };
30
-
31
- const getPrevios: GetSwipeHandler = async (old) => {
32
- let id = old - 1;
33
- id = id >= 0 ? id : COUNT;
34
- return new Promise((resolve) => {
35
- setTimeout(() => {
36
- resolve({
37
- id,
38
- children: <h1>Test {id}</h1>,
39
- });
40
- }, LAG);
41
- });
42
- };
43
-
44
- const App = (): React.ReactElement => {
45
- const [current, setCurrent] = useState<Swipe>();
46
- useEffect(() => {
47
- if (!current) {
48
- (async () => {
49
- setCurrent(await getNext(-1));
50
- })();
51
- }
52
- }, [current]);
53
-
54
- return (
55
- <div className={s.container}>
56
- {current && (
57
- <Swiper
58
- blockSwipe={false}
59
- defaultCurrent={current}
60
- getNext={getNext}
61
- getPrev={getPrevios}
62
- invitationAnimation={true}
63
- className="card__content"
64
- dots={{
65
- list: [0, 1, 2, 3, 4, 5, 6],
66
- active: current.id || 1,
67
- }}
68
- />
69
- )}
70
- </div>
71
- );
72
- };
73
-
74
- export default App;
Binary file
@@ -1,139 +0,0 @@
1
- .container {
2
- position: relative;
3
- overflow: hidden;
4
- min-width: 320px;
5
- width: 100%;
6
- height: 100%;
7
- min-height: 20vh;
8
- max-width: 100vw;
9
- display: flex;
10
- align-items: center;
11
- justify-content: center;
12
- }
13
-
14
- .paper {
15
- background-color: #fff;
16
- border-radius: 1rem;
17
- }
18
-
19
- .pipe {
20
- position: relative;
21
- width: 100%;
22
- height: 100%;
23
- }
24
-
25
- .card {
26
- position: absolute;
27
- max-width: inherit;
28
- top: 0;
29
- left: 0;
30
- display: flex;
31
- align-items: center;
32
- justify-content: center;
33
- flex-direction: column;
34
- }
35
- .prev {
36
- left: -100%;
37
- }
38
- .next {
39
- left: 100%;
40
- }
41
- .back {
42
- transition: left 0.4s ease-in 0s;
43
- }
44
- .go {
45
- transition: left 0.4s ease-out 0s;
46
- }
47
-
48
- .card__stop {
49
- width: 100%;
50
- height: 100%;
51
- position: relative;
52
- }
53
-
54
- .content {
55
- border-radius: 2px;
56
- position: relative;
57
- width: calc(100% - 48px);
58
- height: calc(100% - 48px);
59
- -webkit-box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);
60
- -moz-box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);
61
- box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);
62
- }
63
-
64
- .button {
65
- cursor: pointer;
66
- position: absolute;
67
- width: auto;
68
- height: auto;
69
- display: flex;
70
- align-items: center;
71
- z-index: 12;
72
- }
73
-
74
- .button__next {
75
- right: 0;
76
- }
77
-
78
- .button__prev {
79
- left: 0;
80
- transform: rotate(180deg);
81
- }
82
-
83
- .icon__button {
84
- display: -webkit-inline-box;
85
- display: -webkit-inline-flex;
86
- display: -ms-inline-flexbox;
87
- display: inline-flex;
88
- align-items: center;
89
- justify-content: center;
90
- position: relative;
91
- box-sizing: border-box;
92
- background-color: transparent;
93
- outline: 0;
94
- border: 0;
95
- margin: 0;
96
- border-radius: 0;
97
- padding: 0;
98
- cursor: pointer;
99
- user-select: none;
100
- vertical-align: middle;
101
- text-decoration: none;
102
- color: inherit;
103
- text-align: center;
104
- flex: 0 0 auto;
105
- font-size: 1.5rem;
106
- padding: 8px;
107
- border-radius: 50%;
108
- overflow: visible;
109
- color: rgba(0, 0, 0, 0.54);
110
- transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
111
- }
112
- .icon__button:hover {
113
- background-color: rgba(0, 0, 0, 0.054);
114
- }
115
- .icon__button:active {
116
- background-color: rgba(0, 0, 0, 0.007);
117
- }
118
-
119
- .dots {
120
- position: absolute;
121
- display: flex;
122
- flex-direction: row;
123
- bottom: 0;
124
- }
125
-
126
- .dot {
127
- cursor: pointer;
128
- position: relative;
129
- width: 8px;
130
- height: 8px;
131
- margin: 2px;
132
- border: 1px solid gray;
133
- border-radius: 50%;
134
- }
135
-
136
- .dot.active {
137
- cursor: default;
138
- background-color: gray;
139
- }