Skip to content

Commit

Permalink
Revert "heart"
Browse files Browse the repository at this point in the history
This reverts commit 81001e1.
  • Loading branch information
kailasnadh790 committed May 7, 2024
1 parent 81001e1 commit 008873e
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 225 deletions.
4 changes: 2 additions & 2 deletions blocks/property-listing/cards/cards.css
Original file line number Diff line number Diff line change
Expand Up @@ -274,15 +274,15 @@
display: none;
}

.property-list-cards .property-details .property-buttons .icon-heartfilled {
.property-list-cards .property-details .property-buttons .icon-heartemptydark {
display: none;
}

.property-list-cards .property-details .property-buttons .button-property:hover .icon-envelopedark {
display: block;
}

.property-list-cards .property-details .property-buttons .button-property:hover .icon-heartfilled {
.property-list-cards .property-details .property-buttons .button-property:hover .icon-heartemptydark {
display: block;
}

Expand Down
32 changes: 11 additions & 21 deletions blocks/property-listing/cards/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function createCard(listing) {
</a>
<a aria-label="Save" href="#" class="button-property">
<span class="icon icon-heartempty"></span>
<span class="icon icon-heartfilled"></span>
<span class="icon icon-heartemptydark"></span>
</a>
</div>
</div>
Expand Down Expand Up @@ -136,25 +136,15 @@ export async function render(searchParams, parent) {
}

export async function renderSavedProperties(contactKey, parent) {
return new Promise((resolve) => {
const list = document.createElement('div');
list.classList.add('property-list-cards');
parent.append(list);
getSavedProperties(contactKey).then((results) => {
if (results?.properties) {
const promises = results.properties.map((listing) => {
return new Promise((resolve) => {
list.append(createCard(listing));
resolve();
});
});
Promise.all(promises).then(() => {
decorateIcons(parent);
resolve();
});
} else {
resolve();
}
});
const list = document.createElement('div');
list.classList.add('property-list-cards');
parent.append(list);
getSavedProperties(contactKey).then((results) => {
if (results?.properties) {
results.properties.forEach((listing) => {
list.append(createCard(listing));
});
decorateIcons(parent);
}
});
}
2 changes: 1 addition & 1 deletion blocks/property-result-map/map-delayed.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ function Aj(a) {
luxury: !1,
isCompanyListing: !1,
} : f;
a = a.ƒ;
a = a.propertyProviders;
// @todo prepare content for info window
const cont = new Template().render({
image: c,
Expand Down
110 changes: 1 addition & 109 deletions blocks/saved-properties/saved-properties.css
Original file line number Diff line number Diff line change
@@ -1,109 +1 @@
@import url('../../blocks/property-listing/property-listing.css');

.property-list-cards .property-details .property-buttons .button-property .icon-heartfilled {
display: block;
}

.property-list-cards .property-details .property-buttons .button-property .icon-heartempty {
display: none;
}

.cmp-confirmation-modal {
border: 0;
display: none;
background: #fff;
position: fixed;
z-index: 1050;
right: auto;
left: auto;
top: auto;
bottom: auto;
min-height: 0;
padding: 20px 20px 30px 20px;
height: auto;
width: 100%;
max-width: -webkit-calc(100vw - 30px);
max-width: calc(100vw - 30px);
}

/* prevent scroll on the body when the modal is open */
body.modal-open {
overflow: hidden;
}

.cmp-confirmation-modal.open {
display: block;
z-index: 1050;
opacity: 1;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}

.cmp-form-loader {
position: relative;
}

.cmp-form-loader__content {
position: relative;
}

.cmp-confirmation-modal .message {
font-family: "Manrope";
font-size: 22px;
font-style: normal;
font-weight: 400;
letter-spacing: normal;
line-height: 140%;
color: #3a3a3a;
text-align: center;
}

.cmp-confirmation-modal .cmp-cta {
width: 165px;
}

/* apply a right marging for the first .cmp-cta button */
.cmp-confirmation-modal .cmp-cta:first-child {
margin-right: .5rem;
}


/* make .confirmation-modal-buttons a flex container and align the buttons in the center and space-between */
.cmp-confirmation-modal .confirmation-modal-buttons {
display: flex;
margin-top: 10px;
justify-content: center;
}

.cmp-confirmation-modal .confirmation-modal-buttons .modal-cta .btn {
cursor: pointer;
text-align: center;
}

.cmp-confirmation-modal.open + .cmp-confirmation-modal__overlay {
display: block;
}

.cmp-confirmation-modal__overlay {
background-color: #212529;
width: 100%;
height: 100%;
position: fixed;
opacity: .5;
z-index: 1040;
display: none;
top: 0;
left: 0;
}

@media screen and (min-width: 600px){
.cmp-confirmation-modal {
width: 500px;
padding: 30px;
}

.cmp-confirmation-modal .modal-cta .btn {
display: inline-block;
}
}
@import url('../../blocks/property-listing/property-listing.css');
44 changes: 0 additions & 44 deletions blocks/saved-properties/saved-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,4 @@ export default async function decorate(block) {
}
const contactKey = user.contactKey;
await renderCards(contactKey, block);
const unsaveModal = document.createElement('div');
unsaveModal.innerHTML = `<div class="cmp-confirmation-modal">
<div class="cmp-form-loader">
<div class="cmp-form-loader__content">
<div class="message">Are you sure you want to unsave this property?</div>
<div class="confirmation-modal-buttons">
<section class="cmp-cta modal-cta mr-2"><a rel="noopener noreferrer" href="javascript:void(0)" tabindex="" class="btn btn-primary" role="button"><span class="cmp-cta__btn-text">
Unsave
</span></a>
</section>
<section class="cmp-cta modal-cta cancel-button"><a rel="noopener noreferrer" href="javascript:void(0)" tabindex="" class="btn btn-secondary" role="button"><span class="cmp-cta__btn-text">
cancel
</span></a>
</section>
</div>
</div>
</div>
</div>
<div class="cmp-confirmation-modal__overlay"></div>`;
block.append(unsaveModal);

// click event property-list-cards aria-label="Save"
const saveButtons = document.querySelectorAll('.saved-properties .button-property .icon-heartfilled');
console.log('saveButtons',saveButtons);
saveButtons.forEach((button) => {
button.addEventListener('click', (e) => {
e.preventDefault();
const confirmationModal = block.querySelector('.cmp-confirmation-modal');
confirmationModal.classList.add('open');
const $body = document.querySelector('body');
$body.classList.add('modal-open');
});
});

// onclick of cancel-button close the modal
const cancelButton = block.querySelector('.cancel-button');
cancelButton.addEventListener('click', (e) => {
e.preventDefault();
const confirmationModal = block.querySelector('.cmp-confirmation-modal');
confirmationModal.classList.remove('open');
const $body = document.querySelector('body');
$body.classList.remove('modal-open');
});

}
7 changes: 0 additions & 7 deletions icons/heartfilled.svg

This file was deleted.

16 changes: 5 additions & 11 deletions scripts/apis/creg/creg.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,9 @@ export function propertySearch(params) {
*/
export function getSavedProperties(contactKey) {
return new Promise((resolve) => {
//get current timestamp
const timestamp = Date.now();
const url = `${CREG_API_URL}/cregPropertySaveServlet?ContactKey=${contactKey}&_=${timestamp}`;
fetch(url).then(async (resp) => {
if (resp.ok) {
resolve(await resp.json());
} else {
resolve({});
}
});
});
const worker = new Worker(`${window.hlx.codeBasePath}/scripts/apis/creg/workers/propertySearch.js`);
const url = `${CREG_API_URL}/cregPropertySaveServlet?ContactKey=${contactKey}&_=1714144375935`;
worker.onmessage = (e) => resolve(e.data);
worker.postMessage({ url });
});
}
30 changes: 0 additions & 30 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -444,36 +444,6 @@ main .section.banner .default-content-wrapper {
text-transform: uppercase;
}

.btn {
font-family: "Manrope";
font-weight: 400;
letter-spacing: 1px;
text-transform: uppercase;
text-decoration: none;
white-space: normal;
padding: 7px 25px;
font-size: 14px;
line-height: 1.5;
border-radius: 0;
width: 100%;
}

.btn.btn-primary{
background: #670038;
color: #f5f1f2;
border: 0;
font-size: 16px;
}

.btn.btn-secondary{
background: #fff;
color: #670038;
border: 1px solid #670038;
font-size: 16px;
}



.btn:not(:disabled, .disabled) {
cursor: pointer;
}
Expand Down

0 comments on commit 008873e

Please sign in to comment.