Skip to content

Commit

Permalink
refactor: allow closing the upsell modal for Custom Layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Jan 30, 2025
1 parent 8f8e2b0 commit 3b92fb3
Showing 1 changed file with 32 additions and 4 deletions.
36 changes: 32 additions & 4 deletions inc/admin/hooks_upsells.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,18 +270,24 @@ public function render_custom_layouts_upsell_modal() {
}

/* ----- CLOSE BUTTON ----- */
.cl-close-button {
.cl-modal-dismiss .cl-close-button {
position: absolute;
top: 10px;
right: 10px;
font-size: 24px;
color: #aaa;
cursor: pointer;
min-width: 30px;;
text-decoration: none;
}
.cl-close-button:hover {

.cl-modal-dismiss .cl-close-button:hover {
color: #333;
}

.cl-modal-dismiss .cl-close-button span {
color: black;
font-size: 2rem;
}

/* ----- HEADER / TITLE ----- */
.cl-modal-header {
text-align: center;
Expand Down Expand Up @@ -398,6 +404,12 @@ public function render_custom_layouts_upsell_modal() {

<div class="cl-overlay">
<div class="cl-modal">
<div class="cl-modal-dismiss">
<button id="cl-close-modal" class="cl-close-button button button-link">
<span class="dashicons dashicons-no-alt" aria-hidden="true"></span>
<span class="screen-reader-text"><?php echo esc_html__( 'Close', 'neve' ); ?></span>
</button>
</div>
<div class="cl-modal-header">
<span class="dashicons dashicons-star-filled" aria-hidden="true"></span>
<h2><?php echo esc_html__( 'Take Your Site to the Next Level', 'neve' ); ?></h2>
Expand Down Expand Up @@ -460,6 +472,22 @@ public function render_custom_layouts_upsell_modal() {
</div>
</div>
</div>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function() {
const overlay = document.querySelector('.cl-overlay');
if ( ! overlay ) {
return;
}

document.getElementById('cl-close-modal')?.addEventListener('click', function() {
overlay.style.display = 'none';
});

document.getElementById('cl-open-modal')?.addEventListener('click', function() {
overlay.style.display = 'flex';
});
});
</script>
<?php
}

Expand Down

0 comments on commit 3b92fb3

Please sign in to comment.