allaw-ui 5.2.3 → 5.2.5

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.
@@ -8,6 +8,7 @@ export type EntityCardProps = {
8
8
  onActionButtonClick?: () => void;
9
9
  onCardClick?: () => void;
10
10
  role?: "member" | "admin" | "pending";
11
+ logoUrl?: string;
11
12
  };
12
- declare function EntityCard({ entityName, numberOfMembers, formatedAddress, immat, actionType, onActionButtonClick, onCardClick, role, }: EntityCardProps): React.JSX.Element;
13
+ declare function EntityCard({ entityName, numberOfMembers, formatedAddress, immat, actionType, onActionButtonClick, onCardClick, role, logoUrl, }: EntityCardProps): React.JSX.Element;
13
14
  export default EntityCard;
@@ -1,4 +1,5 @@
1
- import React from "react";
1
+ import React, { useState } from "react";
2
+ import Image from "next/image";
2
3
  import styles from "./entityCard.module.css";
3
4
  import TertiaryButton from "../../atoms/buttons/TertiaryButton";
4
5
  import TinyInfo from "../../atoms/typography/TinyInfo";
@@ -59,10 +60,15 @@ var RoleTag = function (_a) {
59
60
  return (React.createElement(InlineTag, { style: config.style, size: config.size, text: config.text, backgroundColor: config.backgroundColor }));
60
61
  };
61
62
  function EntityCard(_a) {
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;
63
+ 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, logoUrl = _a.logoUrl;
64
+ var _b = useState(false), imgError = _b[0], setImgError = _b[1];
63
65
  return (React.createElement("div", { className: styles.card, style: { cursor: onCardClick ? "pointer" : "default" }, onClick: function () { return onCardClick && onCardClick(); } },
64
- React.createElement("div", { className: styles.picturePlaceHolder },
65
- React.createElement("i", { className: "allaw-icon-home" })),
66
+ React.createElement("div", { className: "".concat(styles.picturePlaceHolder, " ").concat(logoUrl && !imgError ? styles.hasLogo : "") }, logoUrl && !imgError ? (React.createElement(Image, { src: logoUrl, alt: "Logo ".concat(entityName), width: 64, height: 64, quality: 100, onError: function () { return setImgError(true); }, style: {
67
+ objectFit: "cover",
68
+ width: "100%",
69
+ height: "100%",
70
+ borderRadius: "8px",
71
+ } })) : (React.createElement("i", { className: "allaw-icon-home" }))),
66
72
  React.createElement("div", { className: styles.dataInfo },
67
73
  React.createElement("div", { className: styles.basicsInfo },
68
74
  React.createElement("div", { className: styles.entityNameWrapper },
@@ -29,6 +29,10 @@
29
29
  flex-shrink: 0;
30
30
  }
31
31
 
32
+ .picturePlaceHolder.hasLogo {
33
+ padding: 0px;
34
+ }
35
+
32
36
  .dataInfo {
33
37
  display: flex;
34
38
  flex-direction: row;
@@ -210,6 +214,10 @@
210
214
  padding: 6px;
211
215
  }
212
216
 
217
+ .picturePlaceHolder.hasLogo {
218
+ padding: 0px;
219
+ }
220
+
213
221
  .entityName {
214
222
  font-size: 14px;
215
223
  line-height: 20px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "allaw-ui",
3
- "version": "5.2.3",
3
+ "version": "5.2.5",
4
4
  "description": "Composants UI pour l'application Allaw",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",