mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-04-19 01:43:44 +03:00
Pledge edit button: Style the dialog on small screens
This commit is contained in:
parent
be62f41e43
commit
c703c7cefa
|
@ -20,6 +20,13 @@ jQuery( document ).ready( function( $ ) {
|
||||||
const bounds = button.getBoundingClientRect();
|
const bounds = button.getBoundingClientRect();
|
||||||
const modalWidth = 300; // Modal width is hardcoded, because it's not visible yet.
|
const modalWidth = 300; // Modal width is hardcoded, because it's not visible yet.
|
||||||
|
|
||||||
|
if ( button.closest('.wp-block-wporg-pledge-edit-button') ) {
|
||||||
|
return {
|
||||||
|
top: bounds.y + offsetTop + bounds.height,
|
||||||
|
left: bounds.x + offsetLeft,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
top: bounds.y + offsetTop + bounds.height,
|
top: bounds.y + offsetTop + bounds.height,
|
||||||
left: bounds.x + offsetLeft + bounds.width - modalWidth,
|
left: bounds.x + offsetLeft + bounds.width - modalWidth,
|
||||||
|
|
|
@ -15,7 +15,6 @@ const Edit = () => {
|
||||||
return (
|
return (
|
||||||
<div { ...blockProps }>
|
<div { ...blockProps }>
|
||||||
<button>
|
<button>
|
||||||
<span className="dashicons dashicons-edit" aria-hidden="true"></span>
|
|
||||||
Edit Pledge
|
Edit Pledge
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,11 +29,25 @@
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update layout to floating modal on smaller screens. */
|
||||||
|
@media (max-width: 889px) {
|
||||||
|
position: fixed;
|
||||||
|
top: 80px !important;
|
||||||
|
right: var(--wp--preset--spacing--30) !important;
|
||||||
|
left: var(--wp--preset--spacing--30) !important;
|
||||||
|
width: calc(100% - var(--wp--preset--spacing--30) * 2);
|
||||||
|
z-index: 251; /* header + 1. */
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
top: var(--wp--preset--spacing--30) !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pledge-dialog__background {
|
.pledge-dialog__background {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 99;
|
z-index: 251; /* header + 1. */
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
@ -42,4 +56,9 @@
|
||||||
&[hidden] {
|
&[hidden] {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update layout to floating modal on smaller screens. */
|
||||||
|
@media (max-width: 889px) {
|
||||||
|
background-color: rgba(0, 0, 0, 0.15);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue