Skip to content

Commit

Permalink
Basic structure for popups
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Apr 8, 2024
1 parent a407589 commit c0e8169
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 8 deletions.
41 changes: 34 additions & 7 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
color: var(--prpl-color-text);
font-size: var(--prpl-font-size-base);
line-height: 1.4
position: relative;
}

/*------------------------------------*\
Expand Down Expand Up @@ -483,15 +484,13 @@ button.prpl-info-icon {
}

/*------------------------------------*\
Popups.
Popups overlay.
\*------------------------------------*/
#prpl-popup-container,
#prpl-popup-body-overlay {
display: none;
position: fixed;
}

#prpl-popup-body-overlay {
position: absolute;
margin-left: -20px;
padding-left: 20px;
top: 0;
left: 0;
width: 100%;
Expand All @@ -504,8 +503,36 @@ button.prpl-info-icon {
display: block;
}

/*------------------------------------*\
Popups generic styles.
\*------------------------------------*/
#prpl-popup-container {
display: none;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: #fff;
border: 1px solid var(--prpl-color-gray-3);
border-radius: var(--prpl-border-radius);
padding: var(--prpl-padding);
z-index: 1001;
min-width: 300px;
min-height: 200px;
}

.prpl-popup-open #prpl-popup-container {
display: block;
z-index: 1001;
}
/* prpl-popup-badges-details */

/*------------------------------------*\
Popups generic styles.
\*------------------------------------*/
#prpl-popup-badges-details {
display: none;
}

body.prpl-popup-open.prpl-popup-badges-details #prpl-popup-badges-details {
display: block;
}
30 changes: 30 additions & 0 deletions classes/popups/class-badges.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php
/**
* Activity Scores Widget.
*
* @package ProgressPlanner
*/

namespace ProgressPlanner\Popups;

/**
* Activity Scores Widget.
*/
final class Badges extends Popup {

/**
* The popup ID.
*
* @var string
*/
protected $id = 'badges-details';

/**
* Render the widget content.
*/
protected function the_content() {

Check failure on line 25 in classes/popups/class-badges.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Method ProgressPlanner\Popups\Badges::the_content() has no return type specified.

Check failure on line 25 in classes/popups/class-badges.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Method ProgressPlanner\Popups\Badges::the_content() has no return type specified.
?>
Test
<?php
}
}
44 changes: 44 additions & 0 deletions classes/popups/class-popup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
/**
* Activity Scores Widget.
*
* @package ProgressPlanner
*/

namespace ProgressPlanner\Popups;

/**
* Activity Scores Widget.
*/
abstract class Popup {

/**
* The popup ID.
*
* @var string
*/
protected $id;

/**
* Constructor.
*/
public function __construct() {
$this->render();
}

/**
* Render the widget content.
*/
public function render() {

Check failure on line 32 in classes/popups/class-popup.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Method ProgressPlanner\Popups\Popup::render() has no return type specified.

Check failure on line 32 in classes/popups/class-popup.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Method ProgressPlanner\Popups\Popup::render() has no return type specified.
?>
<div id="prpl-popup-<?php echo \esc_attr( $this->id ); ?>" class="prpl-popup">
<?php $this->the_content(); ?>
</div>
<?php
}

/**
* Render the widget content.
*/
abstract protected function the_content();

Check failure on line 43 in classes/popups/class-popup.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Method ProgressPlanner\Popups\Popup::the_content() has no return type specified.

Check failure on line 43 in classes/popups/class-popup.php

View workflow job for this annotation

GitHub Actions / Static Analysis

Method ProgressPlanner\Popups\Popup::the_content() has no return type specified.
}
2 changes: 1 addition & 1 deletion views/admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
</div>
<div id="prpl-popup-body-overlay"></div>
<div id="prpl-popup-container">
<div class="prpl-popup-body"></div>
<?php new \ProgressPlanner\Popups\Badges(); ?>
</div>
</div>

0 comments on commit c0e8169

Please sign in to comment.