my-animated-components 1.0.0 → 1.0.2
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/package.json +1 -1
- package/readme.md +14 -60
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,66 +1,20 @@
|
|
|
1
|
-
#
|
|
2
|
-
this is pagination hook with array of data
|
|
1
|
+
# Animated Components
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
import { usePagination } from 'data-paginate';
|
|
3
|
+
**Animated Components** is a collection of customizable React components built with Framer Motion for smooth animations. It provides buttons and icon buttons with different styles, sizes, and interactive animations.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
{ id: 1, name: 'Item 1' },
|
|
9
|
-
{ id: 2, name: 'Item 2' },
|
|
10
|
-
// Add more items as needed
|
|
11
|
-
];
|
|
5
|
+
---
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
const limit = 10; // Number of items per page
|
|
15
|
-
const { paginatedData, page, totalPages, nextPage, prevPage, goToPage } = usePagination(data, limit);
|
|
7
|
+
## Features
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
{paginatedData.map((item) => (
|
|
21
|
-
<li key={item.id}>{item.name}</li>
|
|
22
|
-
))}
|
|
23
|
-
</ul>
|
|
24
|
-
<div>
|
|
25
|
-
<button onClick={prevPage} disabled={page === 1}>
|
|
26
|
-
Previous
|
|
27
|
-
</button>
|
|
28
|
-
<span>
|
|
29
|
-
Page {page} of {totalPages}
|
|
30
|
-
</span>
|
|
31
|
-
<button onClick={nextPage} disabled={page === totalPages}>
|
|
32
|
-
Next
|
|
33
|
-
</button>
|
|
34
|
-
</div>
|
|
35
|
-
<div>
|
|
36
|
-
{Array.from({ length: totalPages }, (_, index) => (
|
|
37
|
-
<button key={index + 1} onClick={() => goToPage(index + 1)}>
|
|
38
|
-
{index + 1}
|
|
39
|
-
</button>
|
|
40
|
-
))}
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
);
|
|
44
|
-
}
|
|
9
|
+
- **Customizable Buttons**: Supports different variants (`solid`, `outline`, `ghost`) and colors (`primary`, `secondary`).
|
|
10
|
+
- **Icon Button**: Use any custom icon inside the button.
|
|
11
|
+
- **Framer Motion Animations**: Interactive hover and tap animations to enhance user experience.
|
|
45
12
|
|
|
46
|
-
|
|
13
|
+
---
|
|
47
14
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
onPrevPage: Function to handle previous page navigation.
|
|
55
|
-
onGoToPage: Function to handle navigating to a specific page.
|
|
56
|
-
usePagination Hook Parameters
|
|
57
|
-
data: Array of items to paginate.
|
|
58
|
-
limit: Number of items per page.
|
|
59
|
-
initialPage: Initial page number (default: 1).
|
|
60
|
-
usePagination Hook Return Value
|
|
61
|
-
paginatedData: Array of items for the current page.
|
|
62
|
-
page: Current page number.
|
|
63
|
-
totalPages: Total number of pages.
|
|
64
|
-
nextPage: Function to navigate to the next page.
|
|
65
|
-
prevPage: Function to navigate to the previous page.
|
|
66
|
-
goToPage: Function to navigate to a specific page.
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
To install **my-animated-components** in your React project, run the following command:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install my-animated-components
|