Skip to content

Commit 4b4b293

Browse files
committed
ADD: props deails in readme
1 parent afdf7a7 commit 4b4b293

File tree

2 files changed

+24
-59
lines changed

2 files changed

+24
-59
lines changed

README.md

Lines changed: 23 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@ This component will be upgraded and updated regularly for better use, in the sma
5656
- Supports search.
5757
- Supports pagination if an api url added for better SEO and user experience.
5858
- Supports external data by props data and internal data by adding the api url.
59+
## Props
60+
61+
62+
| prop name | required | options | description |
63+
| --------- |:--------:| ------- | ----------- |
64+
| **headCells** | `true` | Array of object | The **headCells** props tell the component what columns do you want to show from the array and how you want to show it. There are some required object keys: `id`, `label`, `width` (as integer in px); and other options like: `sortable` (bool), `numeric` (bool !helps to sort as number!), `render` (a custom column, html, css, javascript, react !you can do all!) |
65+
| **data** | `true` if `url` prop is not used | Array of object | Prerendered data useful if using [NextJs](http://nextjs.org) framework for server side rendering OR `url` prop can't be used in your case...|
66+
| **url** | `true` if `data` prop is not used | String | fetch data on the component mount if prop `data` doesn't exist. And on search adding a query param called `search`, on row number change adding a query param called `limit` and on page change adding a query param called `page`. The best news is that they also work as a combination on the this `url` prop that will work as `paginated api` |
67+
| **title** | `false` | String/React component | It's mainly to be a title or a button |
68+
| **searchDebounceTime** | `false` | Integer default is 800 in (ms) | configure the time you need the search api to start seaching after stop typing in the search box|
69+
| **noPagination** | `false` | Boolean | |
70+
| **rowsPerPage** | `false` | Integer default is 10 | |
71+
| **rowsPerPageOptions** | `false` | array default is [5, 10, 25, 50] | |
5972

6073
## Example
6174

@@ -106,43 +119,25 @@ const headCells = [
106119

107120
const data = [
108121
{
109-
_id: "6144e83a966145976c75cdfe",
110-
email: "minagerges123@gmail.com",
122+
_id: "6144145976c7fe",
123+
email: "minageres123@gmail.com",
111124
name: "Mina",
112-
phone: "+96170345114",
125+
phone: "+9617099995114",
113126
subject: "test",
114127
message: "ahlannn",
115128
date: "2021-09-17 19:10:50",
116129
},
117130
{
118-
_id: "61439914086a4f4e9f9d87cd",
119-
email: "amineamine1996@gmail.com",
120-
name: "amine amine",
121-
phone: "+96176466341",
122-
subject: "12121",
123-
message: "121212121212121",
124-
date: "2021-09-16 22:20:52",
125-
},
126-
{
127-
_id: "61439887086a4f4e9f9d87cc",
131+
_id: "6143989f9d87cc",
128132
email: "as@a.com",
129133
name: "as",
130-
phone: "+96176466341",
134+
phone: "+9617646699991",
131135
subject: "as",
132136
message: "as",
133137
date: "2021-09-16 22:18:31",
134138
},
135139
{
136-
_id: "6143985d086a4f4e9f9d87cb",
137-
email: "amineamine19961996@gmail.com",
138-
name: "amine amine",
139-
phone: "+96176466341",
140-
subject: "1234",
141-
message: "sdsdsd",
142-
date: "2021-09-16 22:17:49",
143-
},
144-
{
145-
_id: "614397edcbfc69177da008c8",
140+
_id: "614397edc9177d8c8",
146141
email: "amine@amine.com",
147142
name: "amine",
148143
phone: "+334343439393993",
@@ -151,46 +146,19 @@ const data = [
151146
date: "2021-09-16 22:15:57",
152147
},
153148
{
154-
_id: "6143b810d713e67dfca4985c",
149+
_id: "6143be67dfca4985c",
155150
email: "dominique.amine@gmail.com",
156151
name: "Dominique",
157-
phone: "+96181304686",
152+
phone: "+96189904686",
158153
subject: "Dev ",
159154
message: "Ohmaga",
160155
date: "2021-09-16 21:33:04",
161156
},
162157
{
163-
_id: "61439b2f0b93c171aa1cf475",
164-
email: "amineamine19961996@gmail.com",
165-
name: "Jean Claude Samaha Bartender",
166-
phone: "+96170492931",
167-
subject: "cv application",
168-
message: "hello amine this a test email ",
169-
date: "2021-09-16 19:29:51",
170-
},
171-
{
172-
_id: "6117aeca1e925fd9dbc2bc6d",
173-
email: "amineamine19961996@gmail.com",
174-
name: "amine amine",
175-
phone: "+96176466341",
176-
subject: "1234",
177-
message: "wwww",
178-
date: "2021-08-14 14:53:46",
179-
},
180-
{
181-
_id: "61141f32cbfa7dbd8dba189f",
182-
email: "amineamine19961996@gmail.com",
183-
name: "amine amine",
184-
phone: "+96176466341",
185-
subject: "aa",
186-
message: "23232",
187-
date: "2021-08-11 22:04:18",
188-
},
189-
{
190-
_id: "61141e57cbfa7dbd8dba189e",
158+
_id: "61141e57a7dbd8a189e",
191159
email: "amineamine19961996@gmail.com",
192160
name: "amine amine",
193-
phone: "+96176466341",
161+
phone: "+96176776341",
194162
subject: "qw",
195163
message: "qw",
196164
date: "2021-08-11 22:00:39",
@@ -203,9 +171,6 @@ export default function Exemple() {
203171
title="Emails"
204172
data={data}
205173
headCells={headCells}
206-
// url="/api/admin/emails"
207-
// searchDebounceTime={800}
208-
// noPagination
209174
/>
210175
);
211176
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-next-table",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "The SmartTable is a react simple Component based on HTML, CSS, JavaScript, bootstrap. Used for fetching data from a defined api with an option of pagination and search. You can find also many useful options like sorting, selecting columns to show, custom render of cells, fully responsive on all devices, custom react title...",
55
"author": "a-simplecode",
66
"keywords": [

0 commit comments

Comments
 (0)