Skip to content

Commit 1ffb669

Browse files
feat(employees demo): use tableData.json in constants.tsx to avoid duplication
1 parent fcfe01b commit 1ffb669

File tree

2 files changed

+61
-58
lines changed

2 files changed

+61
-58
lines changed
Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,16 @@
1+
import tableData from './tableData.json';
2+
13
export const TITLE_BAR = 'Gestion des collaborateurs';
24
export const TITLE = 'Liste des collaborateurs';
35
export const ROUTE_URL_EMPLOYEES = 'employees';
46
export const TABLE_ITEMS_TYPE = 'collaborateurs';
57

8+
export const SERVICE_NAME = 'employees';
9+
610
export const TABLE_HEADERS = [
711
{ id: 'header', key: 'header', isBlank: true },
812
{ id: 'employee1', key: 'employee1', label: 'Collaborateur 1', field: 'employee1' },
913
{ id: 'employee2', key: 'employee2', label: 'Collaborateur 2', field: 'employee2' },
1014
];
1115

12-
export const SERVICE_NAME = 'employees';
13-
14-
export const TABLE_DATA = [
15-
{
16-
key: '1',
17-
cols: {
18-
header: {
19-
id: 'contact',
20-
label: 'Contact',
21-
isHeader: true,
22-
},
23-
employee1: {
24-
label: 'James Philips',
25-
headers: 'employee1 contact',
26-
},
27-
employee2: {
28-
label: 'Marie Beauchamp',
29-
headers: 'employee2 contact',
30-
},
31-
},
32-
},
33-
{
34-
key: '2',
35-
cols: {
36-
header: {
37-
id: 'position',
38-
label: 'Position',
39-
isHeader: true,
40-
},
41-
employee1: {
42-
label: 'Directeur des ventes',
43-
headers: 'employee1 position',
44-
},
45-
employee2: {
46-
label: 'Manager des ventes',
47-
headers: 'employee2 position',
48-
},
49-
},
50-
},
51-
{
52-
key: '3',
53-
cols: {
54-
header: {
55-
id: 'email',
56-
label: 'Email',
57-
isHeader: true,
58-
},
59-
employee1: {
60-
61-
headers: 'employee1 email',
62-
},
63-
employee2: {
64-
65-
headers: 'employee2 email',
66-
},
67-
},
68-
},
69-
];
16+
export const TABLE_DATA = Object.values(tableData);
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[
2+
{
3+
"key": "1",
4+
"cols": {
5+
"header": {
6+
"id": "contact",
7+
"label": "Contact",
8+
"isHeader": true
9+
},
10+
"employee1": {
11+
"label": "James Philips",
12+
"headers": "employee1 contact"
13+
},
14+
"employee2": {
15+
"label": "Marie Beauchamp",
16+
"headers": "employee2 contact"
17+
}
18+
}
19+
},
20+
{
21+
"key": "2",
22+
"cols": {
23+
"header": {
24+
"id": "position",
25+
"label": "Position",
26+
"isHeader": true
27+
},
28+
"employee1": {
29+
"label": "Directeur des ventes",
30+
"headers": "employee1 position"
31+
},
32+
"employee2": {
33+
"label": "Manager des ventes",
34+
"headers": "employee2 position"
35+
}
36+
}
37+
},
38+
{
39+
"key": "3",
40+
"cols": {
41+
"header": {
42+
"id": "email",
43+
"label": "Email",
44+
"isHeader": true
45+
},
46+
"employee1": {
47+
"label": "[email protected]",
48+
"headers": "employee1 email"
49+
},
50+
"employee2": {
51+
"label": "[email protected]",
52+
"headers": "employee2 email"
53+
}
54+
}
55+
}
56+
]

0 commit comments

Comments
 (0)