allaw-ui 5.0.7 → 5.0.9
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/dist/components/molecules/entityCard/EntityCard.d.ts +2 -1
- package/dist/components/molecules/entityCard/EntityCard.js +45 -20
- package/dist/components/molecules/entityCard/EntityCard.stories.d.ts +8 -0
- package/dist/components/molecules/entityCard/EntityCard.stories.js +12 -0
- package/dist/components/molecules/entityCard/entityCard.module.css +60 -9
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export type EntityCardProps = {
|
|
|
7
7
|
actionType: "QUIT" | "REQUEST" | "REMOVE_REQUEST" | "NONE";
|
|
8
8
|
onActionButtonClick?: () => void;
|
|
9
9
|
onCardClick?: () => void;
|
|
10
|
+
role?: "member" | "admin" | "pending";
|
|
10
11
|
};
|
|
11
|
-
declare function EntityCard({ entityName, numberOfMembers, formatedAddress, immat, actionType, onActionButtonClick, onCardClick, }: EntityCardProps): React.JSX.Element;
|
|
12
|
+
declare function EntityCard({ entityName, numberOfMembers, formatedAddress, immat, actionType, onActionButtonClick, onCardClick, role, }: EntityCardProps): React.JSX.Element;
|
|
12
13
|
export default EntityCard;
|
|
@@ -1,53 +1,78 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styles from "./entityCard.module.css";
|
|
3
|
+
import TertiaryButton from "../../atoms/buttons/TertiaryButton";
|
|
4
|
+
import TinyInfo from "../../atoms/typography/TinyInfo";
|
|
5
|
+
import InlineTag from "../../atoms/tags/InlineTag";
|
|
3
6
|
var ActionButton = function (_a) {
|
|
4
7
|
var type = _a.type, action = _a.action;
|
|
5
8
|
var elements = {
|
|
6
9
|
QUIT: {
|
|
7
10
|
text: "Quitter l'organisation",
|
|
8
11
|
icon: "allaw-icon-close",
|
|
9
|
-
color: "
|
|
12
|
+
color: "actions-error",
|
|
10
13
|
},
|
|
11
14
|
REQUEST: {
|
|
12
15
|
text: "Demander à rejoindre",
|
|
13
16
|
icon: "allaw-icon-arrow-right",
|
|
14
|
-
color: "
|
|
17
|
+
color: "bleu-allaw",
|
|
15
18
|
},
|
|
16
19
|
REMOVE_REQUEST: {
|
|
17
20
|
text: "Annuler la demande",
|
|
18
21
|
icon: "allaw-icon-close",
|
|
19
|
-
color: "
|
|
22
|
+
color: "actions-error",
|
|
20
23
|
},
|
|
21
24
|
NONE: {
|
|
22
25
|
text: "",
|
|
23
26
|
icon: "",
|
|
24
|
-
color: "",
|
|
27
|
+
color: "noir",
|
|
25
28
|
},
|
|
26
29
|
};
|
|
27
|
-
return (React.createElement(
|
|
30
|
+
return (React.createElement(TertiaryButton, { label: elements[type].text, endIcon: elements[type].icon, color: elements[type].color, variant: true, onClick: function () {
|
|
28
31
|
action && action();
|
|
29
|
-
} }
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
} }));
|
|
33
|
+
};
|
|
34
|
+
var RoleTag = function (_a) {
|
|
35
|
+
var role = _a.role;
|
|
36
|
+
if (!role)
|
|
37
|
+
return null;
|
|
38
|
+
var roleConfig = {
|
|
39
|
+
admin: {
|
|
40
|
+
style: "default",
|
|
41
|
+
size: "12",
|
|
42
|
+
text: "admin",
|
|
43
|
+
backgroundColor: "bleu-allaw",
|
|
44
|
+
},
|
|
45
|
+
member: {
|
|
46
|
+
style: "border",
|
|
47
|
+
size: "12",
|
|
48
|
+
text: "membre",
|
|
49
|
+
backgroundColor: "mid-grey",
|
|
50
|
+
},
|
|
51
|
+
pending: {
|
|
52
|
+
style: "border",
|
|
53
|
+
size: "12",
|
|
54
|
+
text: "en attente",
|
|
55
|
+
backgroundColor: "actions-warning",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
var config = roleConfig[role];
|
|
59
|
+
return (React.createElement(InlineTag, { style: config.style, size: config.size, text: config.text, backgroundColor: config.backgroundColor }));
|
|
32
60
|
};
|
|
33
61
|
function EntityCard(_a) {
|
|
34
|
-
var entityName = _a.entityName, numberOfMembers = _a.numberOfMembers, formatedAddress = _a.formatedAddress, immat = _a.immat, actionType = _a.actionType, onActionButtonClick = _a.onActionButtonClick, onCardClick = _a.onCardClick;
|
|
62
|
+
var entityName = _a.entityName, numberOfMembers = _a.numberOfMembers, formatedAddress = _a.formatedAddress, immat = _a.immat, actionType = _a.actionType, onActionButtonClick = _a.onActionButtonClick, onCardClick = _a.onCardClick, role = _a.role;
|
|
35
63
|
return (React.createElement("div", { className: styles.card, style: { cursor: onCardClick ? "pointer" : "default" }, onClick: function () { return onCardClick && onCardClick(); } },
|
|
36
64
|
React.createElement("div", { className: styles.picturePlaceHolder },
|
|
37
65
|
React.createElement("i", { className: "allaw-icon-home" })),
|
|
38
66
|
React.createElement("div", { className: styles.dataInfo },
|
|
39
67
|
React.createElement("div", { className: styles.basicsInfo },
|
|
40
|
-
React.createElement("
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
React.createElement("
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
" membre",
|
|
47
|
-
|
|
48
|
-
React.createElement("span", { className: styles.detail },
|
|
49
|
-
React.createElement("i", { className: "allaw-icon-prestation" }),
|
|
50
|
-
immat))),
|
|
68
|
+
React.createElement("div", { className: styles.entityNameWrapper },
|
|
69
|
+
React.createElement("span", { className: styles.entityName }, entityName),
|
|
70
|
+
React.createElement(RoleTag, { role: role })),
|
|
71
|
+
React.createElement(TinyInfo, { variant: "medium14", color: "dark-grey", text: formatedAddress || "", startIcon: "allaw-icon-map-pin", align: "left" })),
|
|
72
|
+
React.createElement("div", { className: styles.detailsInfoContainer },
|
|
73
|
+
React.createElement("div", { className: styles.detailsInfo },
|
|
74
|
+
React.createElement(TinyInfo, { variant: "medium14", color: "dark-grey", text: "".concat(numberOfMembers, " membre").concat(numberOfMembers > 1 ? "s" : ""), startIcon: "allaw-icon-users", align: "left" }),
|
|
75
|
+
React.createElement(TinyInfo, { variant: "medium14", color: "dark-grey", text: immat || "", startIcon: "allaw-icon-prestation", align: "left" })))),
|
|
51
76
|
actionType != "NONE" && (React.createElement(ActionButton, { type: actionType, action: onActionButtonClick }))));
|
|
52
77
|
}
|
|
53
78
|
export default EntityCard;
|
|
@@ -11,4 +11,12 @@ export const LongContent: any;
|
|
|
11
11
|
export const Mobile: any;
|
|
12
12
|
export const Tablet: any;
|
|
13
13
|
export const NoAction: any;
|
|
14
|
+
export const WithRoleAdmin: any;
|
|
15
|
+
export const WithRoleMember: any;
|
|
16
|
+
export const WithRolePending: any;
|
|
17
|
+
export function AllRoles(): React.JSX.Element;
|
|
18
|
+
export namespace AllRoles {
|
|
19
|
+
let storyName: string;
|
|
20
|
+
}
|
|
14
21
|
import EntityCard from "./EntityCard";
|
|
22
|
+
import React from "react";
|
|
@@ -49,3 +49,15 @@ Tablet.parameters = {
|
|
|
49
49
|
};
|
|
50
50
|
export var NoAction = Template.bind({});
|
|
51
51
|
NoAction.args = __assign(__assign({}, Default.args), { actionType: "NONE" });
|
|
52
|
+
export var WithRoleAdmin = Template.bind({});
|
|
53
|
+
WithRoleAdmin.args = __assign(__assign({}, Default.args), { entityName: "Cabinet Martin & Associés", role: "admin", actionType: "QUIT" });
|
|
54
|
+
export var WithRoleMember = Template.bind({});
|
|
55
|
+
WithRoleMember.args = __assign(__assign({}, Default.args), { entityName: "Cabinet Dupont & Fils", role: "member", actionType: "QUIT" });
|
|
56
|
+
export var WithRolePending = Template.bind({});
|
|
57
|
+
WithRolePending.args = __assign(__assign({}, Default.args), { entityName: "Cabinet Durand", role: "pending", actionType: "REMOVE_REQUEST" });
|
|
58
|
+
export var AllRoles = function () { return (React.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "1rem" } },
|
|
59
|
+
React.createElement(EntityCard, __assign({}, Default.args, { entityName: "Cabinet avec r\u00F4le Admin", role: "admin", actionType: "QUIT", onActionButtonClick: action("QUIT clicked") })),
|
|
60
|
+
React.createElement(EntityCard, __assign({}, Default.args, { entityName: "Cabinet avec r\u00F4le Membre", role: "member", actionType: "QUIT", onActionButtonClick: action("QUIT clicked") })),
|
|
61
|
+
React.createElement(EntityCard, __assign({}, Default.args, { entityName: "Cabinet avec r\u00F4le En attente", role: "pending", actionType: "REMOVE_REQUEST", onActionButtonClick: action("REMOVE_REQUEST clicked") })),
|
|
62
|
+
React.createElement(EntityCard, __assign({}, Default.args, { entityName: "Cabinet sans r\u00F4le", actionType: "REQUEST", onActionButtonClick: action("REQUEST clicked") })))); };
|
|
63
|
+
AllRoles.storyName = "Tous les rôles";
|
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
align-self: stretch;
|
|
10
10
|
border-radius: 16px;
|
|
11
11
|
border: 1.5px solid var(--Primary-Venom-grey, #e6edf5);
|
|
12
|
+
transition: border-color 0.2s ease-in-out;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.card:hover {
|
|
16
|
+
border-color: var(--Primary-Blue-allaw, #25beeb);
|
|
12
17
|
}
|
|
13
18
|
|
|
14
19
|
.picturePlaceHolder {
|
|
@@ -38,8 +43,14 @@
|
|
|
38
43
|
flex-direction: column;
|
|
39
44
|
gap: 0.25rem;
|
|
40
45
|
align-items: start;
|
|
41
|
-
|
|
42
|
-
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.entityNameWrapper {
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
gap: 0.5rem;
|
|
52
|
+
width: 100%;
|
|
53
|
+
min-width: 0;
|
|
43
54
|
}
|
|
44
55
|
|
|
45
56
|
.entityName {
|
|
@@ -51,10 +62,10 @@
|
|
|
51
62
|
font-style: normal;
|
|
52
63
|
font-weight: 600;
|
|
53
64
|
line-height: 22px; /* 137.5% */
|
|
54
|
-
max-width: 100%;
|
|
55
65
|
overflow: hidden;
|
|
56
66
|
text-overflow: ellipsis;
|
|
57
67
|
white-space: nowrap;
|
|
68
|
+
flex-shrink: 1;
|
|
58
69
|
}
|
|
59
70
|
|
|
60
71
|
.numberOfMembers {
|
|
@@ -72,13 +83,24 @@
|
|
|
72
83
|
white-space: nowrap;
|
|
73
84
|
}
|
|
74
85
|
|
|
75
|
-
.
|
|
86
|
+
.detailsInfoContainer {
|
|
76
87
|
display: flex;
|
|
77
|
-
flex-direction:
|
|
78
|
-
gap: 1rem;
|
|
88
|
+
flex-direction: column;
|
|
89
|
+
/* gap: 1rem; */
|
|
79
90
|
align-items: center;
|
|
80
91
|
flex-wrap: wrap;
|
|
81
92
|
flex-shrink: 0;
|
|
93
|
+
flex: 1;
|
|
94
|
+
}
|
|
95
|
+
.detailsInfo {
|
|
96
|
+
display: flex;
|
|
97
|
+
flex-direction: column;
|
|
98
|
+
/* gap: 1rem; */
|
|
99
|
+
align-items: flex-start;
|
|
100
|
+
flex-wrap: wrap;
|
|
101
|
+
flex-shrink: 0;
|
|
102
|
+
flex: 1;
|
|
103
|
+
gap: 0.4rem;
|
|
82
104
|
}
|
|
83
105
|
|
|
84
106
|
.detail {
|
|
@@ -121,6 +143,11 @@
|
|
|
121
143
|
font-size: 12px;
|
|
122
144
|
}
|
|
123
145
|
|
|
146
|
+
.actionButtonWrapper {
|
|
147
|
+
margin-left: auto;
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
}
|
|
150
|
+
|
|
124
151
|
/* Media queries pour la responsivité */
|
|
125
152
|
@media (max-width: 820px) {
|
|
126
153
|
.card {
|
|
@@ -131,12 +158,12 @@
|
|
|
131
158
|
gap: 1.5rem;
|
|
132
159
|
}
|
|
133
160
|
|
|
134
|
-
.detailsInfo {
|
|
161
|
+
/* .detailsInfo {
|
|
135
162
|
gap: 0.75rem;
|
|
136
|
-
}
|
|
163
|
+
} */
|
|
137
164
|
}
|
|
138
165
|
|
|
139
|
-
@media (max-width:
|
|
166
|
+
@media (max-width: 740px) {
|
|
140
167
|
.card {
|
|
141
168
|
flex-direction: column;
|
|
142
169
|
align-items: flex-start;
|
|
@@ -201,3 +228,27 @@
|
|
|
201
228
|
padding: 6px 10px;
|
|
202
229
|
}
|
|
203
230
|
}
|
|
231
|
+
|
|
232
|
+
/* @media (max-width: 941px) {
|
|
233
|
+
.detailsInfoContainer {
|
|
234
|
+
align-items: flex-start;
|
|
235
|
+
}
|
|
236
|
+
} */
|
|
237
|
+
|
|
238
|
+
@media (max-width: 940px) {
|
|
239
|
+
.detailsInfoContainer {
|
|
240
|
+
align-items: flex-start;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@media (max-width: 600px) {
|
|
245
|
+
.actionButtonWrapper {
|
|
246
|
+
margin-left: 0;
|
|
247
|
+
width: 100%;
|
|
248
|
+
order: 10;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.card {
|
|
252
|
+
flex-wrap: wrap;
|
|
253
|
+
}
|
|
254
|
+
}
|