Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: allow closing the upsell modal for Custom Layout #4371

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading