nestiq-component-library 1.1.161 → 1.1.162

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.
@@ -7,6 +7,7 @@ import "../../styles/common.css";
7
7
 
8
8
  interface PopupProps {
9
9
  pictureUrls: { title: string; url: string }[];
10
+ onClose?: () => void;
10
11
  }
11
12
 
12
13
  export default function ImageListPopup(props: PopupProps) {
@@ -35,7 +36,9 @@ export default function ImageListPopup(props: PopupProps) {
35
36
  };
36
37
 
37
38
  const handleClose = () => {
38
- setShowPopUp(false);
39
+ if (props.onClose) {
40
+ props.onClose();
41
+ }
39
42
  };
40
43
 
41
44
  return (
@@ -47,7 +50,7 @@ export default function ImageListPopup(props: PopupProps) {
47
50
  <img
48
51
  src={iconClose}
49
52
  alt="close"
50
- className="closeIcon"
53
+ className="closeIconNestiq"
51
54
  onClick={handleClose}
52
55
  />
53
56
  </div>
@@ -70,7 +73,7 @@ export default function ImageListPopup(props: PopupProps) {
70
73
  </div>
71
74
  <div className="p-2 bd-highlight">
72
75
  <div
73
- className=" rounded-5 mainImage "
76
+ className=" rounded-5"
74
77
  style={{
75
78
  backgroundImage: `url(${props.pictureUrls[currentImageIndex].url})`,
76
79
  height: "465px",
@@ -98,44 +101,51 @@ export default function ImageListPopup(props: PopupProps) {
98
101
  <div className="d-flex flex-row">
99
102
  {/* Arrows on the main image */}
100
103
  </div>
101
- <div className="d-flex flex-row gap-4 w-100 secondList ">
102
- <div className="col-lg-12 d-flex flex-row p-1 align-self-center mt-5">
103
- <div className="col-12 position-relative d-flex justify-content-center">
104
- <div
105
- className="col-lg-10 rounded-3 h-100 w-100 d-flex flex-row gap-2 overflow-auto "
106
- ref={imageListRef}
107
- >
108
- {props.pictureUrls.length > 0 && (
109
- <div className="col-lg-5 d-flex gap-4 flex-row rounded-3">
110
- {props.pictureUrls.map((picture, index) => (
111
- <div
112
- key={index}
113
- className="col-lg-12 d-flex"
114
- onClick={() => {
115
- setCurrentImageIndex(index);
116
- imageListRef.current!.scrollTo({
117
- left: index * 150,
118
- behavior: "smooth",
119
- });
120
- }}
121
- role="button"
122
- style={{
123
- cursor: "pointer",
124
- width: "150px",
125
- height: "150px",
126
- }}
127
- >
128
- <img
129
- src={picture.url}
130
- alt={`Image ${index + 1}`}
131
- className="col-12 h-100 rounded-3 object-fit-cover"
132
- />
133
- </div>
134
- ))}
104
+ <div className="d-flex flex-row justify-content-center w-100 mt-5">
105
+ <div
106
+ className="d-flex flex-row gap-4 overflow-auto px-3"
107
+ ref={imageListRef}
108
+ style={{
109
+ maxWidth: "100%",
110
+ scrollbarWidth: "thin",
111
+ }}
112
+ >
113
+ {props.pictureUrls.length > 0 && (
114
+ <>
115
+ {props.pictureUrls.map((picture, index) => (
116
+ <div
117
+ key={index}
118
+ className={`flex-shrink-0 ${
119
+ index === currentImageIndex
120
+ ? "border border-3 border-primary"
121
+ : ""
122
+ }`}
123
+ onClick={() => {
124
+ setCurrentImageIndex(index);
125
+ imageListRef.current!.scrollTo({
126
+ left: index * 170, // 150px width + gap
127
+ behavior: "smooth",
128
+ });
129
+ }}
130
+ role="button"
131
+ style={{
132
+ cursor: "pointer",
133
+ width: "150px",
134
+ height: "150px",
135
+ }}
136
+ >
137
+ <img
138
+ src={picture.url}
139
+ alt={`Image ${index + 1}`}
140
+ className="w-100 h-100 rounded-3 object-fit-cover"
141
+ style={{
142
+ display: "block",
143
+ }}
144
+ />
135
145
  </div>
136
- )}
137
- </div>
138
- </div>
146
+ ))}
147
+ </>
148
+ )}
139
149
  </div>
140
150
  </div>
141
151
  </div>
@@ -14,6 +14,7 @@ import FloorPlanPopup from "../FloorPlanPopup/FloorPlanPopup";
14
14
  import SharePopup from "../SharePopup/SharePopup";
15
15
  import { MessageModel } from "../../models/message.model";
16
16
  import immooly from "../../assets/images/imooly.svg";
17
+ import ImageListPopup from "../ImageListPopup/ImageListPopup";
17
18
 
18
19
  interface PopupProps {
19
20
  property: {
@@ -36,6 +37,7 @@ interface PopupProps {
36
37
  expose: {
37
38
  title: string;
38
39
  };
40
+ selectedFloorPlan?: string;
39
41
  pictures: { contentUrl: string; pictureType: { id: number } }[];
40
42
  };
41
43
  Impliment: any;
@@ -46,7 +48,7 @@ interface PopupProps {
46
48
  messageOnClick: () => void;
47
49
  onclickSuccess: () => void;
48
50
  onClick: () => void;
49
- onFloorPlanClick: () => void;
51
+ onFloorPlanClick: (images: { url: string; title: string }[]) => void;
50
52
  }
51
53
  export default function PropertyCard(props: PopupProps) {
52
54
  const [liked, setLiked] = useState(false);
@@ -57,6 +59,8 @@ export default function PropertyCard(props: PopupProps) {
57
59
  const [messagePopUp, setMessagPopUp] = useState(false);
58
60
  const [sharePopUp, setSharePopUp] = useState(false);
59
61
 
62
+ const [isImagePopupOpen, setIsImagePopupOpen] = useState(false);
63
+
60
64
  const pictureUrls =
61
65
  props.property?.pictures?.length > 0
62
66
  ? props.property.pictures
@@ -64,13 +68,33 @@ export default function PropertyCard(props: PopupProps) {
64
68
  .map((picture) => `${props.baseUrl}${picture.contentUrl}`)
65
69
  : [noImageIcon];
66
70
 
71
+ const floorPlanImages =
72
+ props.property.pictures
73
+ ?.filter((p) => p.pictureType?.id === 1)
74
+ .map((p, index) => ({
75
+ url: props.baseUrl + p.contentUrl,
76
+ title: `Floor Plan ${index + 1}`,
77
+ })) || [];
78
+
79
+ if (props.property.selectedFloorPlan) {
80
+ floorPlanImages.push({
81
+ url: props.property.selectedFloorPlan,
82
+ title: "Selected Floor Plan",
83
+ });
84
+ }
85
+
67
86
  // setPictureUrls(pictureUrls);
68
87
  const handleLike = () => {
69
88
  setLiked(!liked);
70
89
  };
71
- const floorPlanOnClick = () => {
72
- props.onFloorPlanClick();
90
+
91
+ const handleFloorPlanButton = () => {
92
+ setIsImagePopupOpen(true);
93
+ if (props.onFloorPlanClick) {
94
+ props.onFloorPlanClick(floorPlanImages);
95
+ }
73
96
  };
97
+
74
98
  const handleMessagPopUp = () => {
75
99
  // setMessagPopUp(true);
76
100
  props.messageOnClick();
@@ -146,7 +170,7 @@ export default function PropertyCard(props: PopupProps) {
146
170
  <div
147
171
  className="Grundriss kontact-button-text ms-2 "
148
172
  role="button"
149
- onClick={floorPlanOnClick}
173
+ onClick={() => handleFloorPlanButton()}
150
174
  style={{ marginBottom: "16px" }}
151
175
  >
152
176
  <img src={iconLayers} className="" style={{ width: "18px" }} />{" "}
@@ -355,6 +379,12 @@ export default function PropertyCard(props: PopupProps) {
355
379
  />
356
380
  )} */}
357
381
  {sharePopUp && <SharePopup onClick={() => setSharePopUp(false)} />}
382
+ {isImagePopupOpen && (
383
+ <ImageListPopup
384
+ pictureUrls={floorPlanImages}
385
+ onClose={() => setIsImagePopupOpen(false)}
386
+ />
387
+ )}
358
388
  </div>
359
389
  );
360
390
  }
@@ -121,8 +121,8 @@ export default function PropertyImageList(prop: PopupProps) {
121
121
  index === 0
122
122
  ? "ms-1"
123
123
  : index === prop.pictureUrls.length - 1
124
- ? "me-1"
125
- : ""
124
+ ? "me-1"
125
+ : ""
126
126
  }`}
127
127
  onClick={() => {
128
128
  setCurrentImageIndex(index);
@@ -199,7 +199,12 @@ export default function PropertyImageList(prop: PopupProps) {
199
199
  </div>
200
200
  </div>
201
201
  {/* Popup for all photos */}
202
- {isImagePopupOpen && <ImageListPopup pictureUrls={prop.pictureUrls} />}
202
+ {isImagePopupOpen && (
203
+ <ImageListPopup
204
+ pictureUrls={prop.pictureUrls}
205
+ onClose={() => setIsImagePopupOpen(false)}
206
+ />
207
+ )}
203
208
 
204
209
  {/* Popup for floor plan */}
205
210
  {isFloorPlanPopupOpen && (